diff --git a/composer.json b/composer.json index f98e799c..5fda76b6 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,8 @@ ] }, "scripts": { - "phpstan": "phpstan analyse -c .phpstan.neon" + "phpstan": "phpstan analyse -c .phpstan.neon", + "tests": "tester -C --colors 1 --setup ./tests/inc/setup.php ./tests/cases" }, "config": { "preferred-install": { diff --git a/src/Mapper/Dbal/RelationshipMapperManyHasMany.php b/src/Mapper/Dbal/RelationshipMapperManyHasMany.php index 9b985fd6..4fe8125b 100644 --- a/src/Mapper/Dbal/RelationshipMapperManyHasMany.php +++ b/src/Mapper/Dbal/RelationshipMapperManyHasMany.php @@ -21,6 +21,7 @@ use function count; use function implode; use function json_encode; +use function ksort; use function md5; use function strpos; @@ -178,6 +179,7 @@ private function fetchByTwoPassStrategy(QueryBuilder $builder, array $values): M return new MultiEntityIterator([]); } + ksort($values); // make ids sorted deterministically $entitiesResult = $this->targetMapper->findAll()->findBy(['id' => array_keys($values)]); $entities = $entitiesResult->fetchPairs('id', null); diff --git a/src/Mapper/Dbal/RelationshipMapperOneHasMany.php b/src/Mapper/Dbal/RelationshipMapperOneHasMany.php index 63b213c6..b1349771 100644 --- a/src/Mapper/Dbal/RelationshipMapperOneHasMany.php +++ b/src/Mapper/Dbal/RelationshipMapperOneHasMany.php @@ -23,6 +23,7 @@ use function implode; use function json_encode; use function md5; +use function sort; class RelationshipMapperOneHasMany implements IRelationshipMapper @@ -187,6 +188,7 @@ protected function fetchByTwoPassStrategy(QueryBuilder $builder, array $values): return new MultiEntityIterator([]); } + sort($values); // make ids sorted deterministically if ($isComposite) { $builder = $this->targetMapper->builder(); $builder->andWhere('%multiOr', $ids); diff --git a/src/Repository/Repository.php b/src/Repository/Repository.php index 3072d7e1..b4f745dc 100644 --- a/src/Repository/Repository.php +++ b/src/Repository/Repository.php @@ -41,6 +41,7 @@ use Nextras\Orm\Model\MetadataStorage; use ReflectionClass; use function count; +use function sort; /** @@ -548,6 +549,7 @@ public function doRefreshAll(bool $allowOverwrite): void $ids[] = $entity->getPersistedId(); } if (count($ids) > 0) { + sort($ids); // make ids sorted deterministically $this->findByIds($ids)->fetchAll(); } foreach ($entities as $entity) { diff --git a/tests/cases/integration/Entity/entity.cloning.phpt b/tests/cases/integration/Entity/entity.cloning.phpt index 32bcba63..39faddd9 100644 --- a/tests/cases/integration/Entity/entity.cloning.phpt +++ b/tests/cases/integration/Entity/entity.cloning.phpt @@ -11,6 +11,7 @@ namespace NextrasTests\Orm\Integration\Entity; use NextrasTests\Orm\Author; use NextrasTests\Orm\Book; use NextrasTests\Orm\DataTestCase; +use NextrasTests\Orm\Publisher; use NextrasTests\Orm\Tag; use Tester\Assert; @@ -18,7 +19,7 @@ use Tester\Assert; require_once __DIR__ . '/../../../bootstrap.php'; -class EntityCloning2Test extends DataTestCase +class EntityCloningTest extends DataTestCase { public function testCloningOneHasMany(): void @@ -44,8 +45,9 @@ class EntityCloning2Test extends DataTestCase public function testCloningManyHasMany(): void { - $author = $this->e(Author::class); - $book = $this->e(Book::class, ['author' => $author]); + $author = $this->e(Author::class, ['name' => 'New Author']); + $publisher = $this->e(Publisher::class, ['name' => 'Publisher']); + $book = $this->e(Book::class, ['author' => $author, 'title' => 'New Book', 'publisher' => $publisher]); $tag1 = $this->e(Tag::class, ['name' => 'Tag 1']); $tag2 = $this->e(Tag::class, ['name' => 'Tag 2']); $tag3 = $this->e(Tag::class, ['name' => 'Tag 3']); @@ -59,7 +61,7 @@ class EntityCloning2Test extends DataTestCase Assert::same(3, $newBook->tags->count()); Assert::same([$tag1, $tag2, $tag3], iterator_to_array($newBook->tags)); - $book->author = $this->e(Author::class); + $book->author = $this->e(Author::class, ['name' => 'New Author 2']); $book->tags->set([$tag1, $tag2]); Assert::same($author, $newBook->author); @@ -69,5 +71,5 @@ class EntityCloning2Test extends DataTestCase } -$test = new EntityCloning2Test(); +$test = new EntityCloningTest(); $test->run(); diff --git a/tests/cases/integration/Entity/entity.pk.phpt b/tests/cases/integration/Entity/entity.pk.phpt index 11a3b570..d474230f 100644 --- a/tests/cases/integration/Entity/entity.pk.phpt +++ b/tests/cases/integration/Entity/entity.pk.phpt @@ -22,7 +22,7 @@ class EntityPkTest extends DataTestCase public function testDateTimeWithProxyPk(): void { $log = new Log(); - $log->id = $datetime = new DateTimeImmutable('tomorrow'); + $log->id = $datetime = new DateTimeImmutable('2022-03-06T03:03:03Z'); $log->count = 3; $this->orm->persistAndFlush($log); diff --git a/tests/cases/integration/Mapper/mapper.datetimesimple.phpt b/tests/cases/integration/Mapper/mapper.datetimesimple.phpt index b05beb10..eea14985 100644 --- a/tests/cases/integration/Mapper/mapper.datetimesimple.phpt +++ b/tests/cases/integration/Mapper/mapper.datetimesimple.phpt @@ -24,6 +24,7 @@ class MapperDateTimeSimpleTest extends DataTestCase $author = $this->e( Author::class, [ + 'name' => 'Random Author', 'born' => new DateTimeImmutable('2018-01-09 00:00:00'), ] ); diff --git a/tests/cases/integration/Relationships/relationships.oneHasMany.persistence.phpt b/tests/cases/integration/Relationships/relationships.oneHasMany.persistence.phpt index da7ce910..ecf36a4c 100644 --- a/tests/cases/integration/Relationships/relationships.oneHasMany.persistence.phpt +++ b/tests/cases/integration/Relationships/relationships.oneHasMany.persistence.phpt @@ -28,12 +28,13 @@ require_once __DIR__ . '/../../../bootstrap.php'; class RelationshipsOneHasManyPersistenceTest extends DataTestCase { - public function testPersiting(): void + public function testPersisting(): void { - $author1 = $this->e(Author::class); - $this->e(Book::class, ['author' => $author1, 'title' => 'Book XX']); - $author2 = $this->e(Author::class); - $this->e(Book::class, ['author' => $author2, 'title' => 'Book YY']); + $publisher = $this->e(Publisher::class, ['name' => 'Publisher']); + $author1 = $this->e(Author::class, ['name' => 'Persistence Author']); + $this->e(Book::class, ['author' => $author1, 'title' => 'Book XX', 'publisher' => $publisher]); + $author2 = $this->e(Author::class, ['name' => 'Persistence Author 2']); + $this->e(Book::class, ['author' => $author2, 'title' => 'Book YY', 'publisher' => $publisher]); $this->orm->authors->persist($author1); $this->orm->authors->persist($author2); $this->orm->authors->flush(); @@ -105,9 +106,11 @@ class RelationshipsOneHasManyPersistenceTest extends DataTestCase { if ($this->section === Helper::SECTION_ARRAY) { Environment::skip('Only for DB with foreign key restriction'); - } else if ($this->section === Helper::SECTION_MSSQL) { - $connection = $this->container->getByType(IConnection::class); - $connection->query('SET IDENTITY_INSERT users ON;'); + } else { + if ($this->section === Helper::SECTION_MSSQL) { + $connection = $this->container->getByType(IConnection::class); + $connection->query('SET IDENTITY_INSERT users ON;'); + } } $user = new User(); @@ -117,7 +120,7 @@ class RelationshipsOneHasManyPersistenceTest extends DataTestCase $user->friendsWithMe->add($user2); $userStat = new UserStat(); $userStat->user = $user; - $userStat->date = new DateTimeImmutable(); + $userStat->date = new DateTimeImmutable("2021-12-14 22:03:00"); $userStat->value = 3; $this->orm->persistAndFlush($userStat); diff --git a/tests/cases/integration/Relationships/relationships.oneHasMany.phpt b/tests/cases/integration/Relationships/relationships.oneHasMany.phpt index b7854b8e..9bb3615e 100644 --- a/tests/cases/integration/Relationships/relationships.oneHasMany.phpt +++ b/tests/cases/integration/Relationships/relationships.oneHasMany.phpt @@ -115,17 +115,18 @@ class RelationshipOneHasManyTest extends DataTestCase public function testPersistence(): void { - $author1 = $this->e(Author::class); - $this->e(Book::class, ['author' => $author1, 'title' => 'Book 1']); - $this->e(Book::class, ['author' => $author1, 'title' => 'Book 2']); + $publisher = $this->e(Publisher::class, ['name' => 'Publisher']); + $author1 = $this->e(Author::class, ['name' => 'A1']); + $this->e(Book::class, ['author' => $author1, 'title' => 'Book 1', 'publisher' => $publisher]); + $this->e(Book::class, ['author' => $author1, 'title' => 'Book 2', 'publisher' => $publisher]); - $author2 = $this->e(Author::class); - $this->e(Book::class, ['author' => $author2, 'title' => 'Book 3']); - $this->e(Book::class, ['author' => $author2, 'title' => 'Book 4']); + $author2 = $this->e(Author::class, ['name' => 'A2']); + $this->e(Book::class, ['author' => $author2, 'title' => 'Book 3', 'publisher' => $publisher]); + $this->e(Book::class, ['author' => $author2, 'title' => 'Book 4', 'publisher' => $publisher]); - $author3 = $this->e(Author::class); - $this->e(Book::class, ['author' => $author3, 'title' => 'Book 5']); - $this->e(Book::class, ['author' => $author3, 'title' => 'Book 6']); + $author3 = $this->e(Author::class, ['name' => 'A3']); + $this->e(Book::class, ['author' => $author3, 'title' => 'Book 5', 'publisher' => $publisher]); + $this->e(Book::class, ['author' => $author3, 'title' => 'Book 6', 'publisher' => $publisher]); $this->orm->authors->persist($author1); $this->orm->authors->persist($author2); @@ -270,7 +271,7 @@ class RelationshipOneHasManyTest extends DataTestCase $this->orm->refreshAll(true); $ids = []; - foreach ($tag->tagFollowers as $tagFollower) { + foreach ($tag->tagFollowers->orderBy('author') as $tagFollower) { $ids[] = $tagFollower->author->id; Assert::true($tagFollower->isPersisted()); } diff --git a/tests/cases/integration/Repository/repository.persistence.phpt b/tests/cases/integration/Repository/repository.persistence.phpt index ba89824a..e9787a04 100644 --- a/tests/cases/integration/Repository/repository.persistence.phpt +++ b/tests/cases/integration/Repository/repository.persistence.phpt @@ -12,6 +12,7 @@ use Nextras\Dbal\Utils\DateTimeImmutable; use Nextras\Orm\Exception\NullValueException; use NextrasTests\Orm\Author; use NextrasTests\Orm\Book; +use NextrasTests\Orm\DataTestCase; use NextrasTests\Orm\Publisher; use NextrasTests\Orm\Tag; use NextrasTests\Orm\TestCase; @@ -21,7 +22,7 @@ use Tester\Assert; require_once __DIR__ . '/../../../bootstrap.php'; -class RepositoryPersistenceTest extends TestCase +class RepositoryPersistenceTest extends DataTestCase { public function testComplexPersistenceTree(): void @@ -130,14 +131,18 @@ class RepositoryPersistenceTest extends TestCase // assign all tags to publisher $allTags = $this->orm->tags->findAll()->fetchAll(); $publisher = $this->e(Publisher::class, [ + 'name' => 'Nextras Publisher', 'tags' => $allTags, ]); $this->orm->publishers->persistAndFlush($publisher); // assign publisher and only one tag $book = $this->e(Book::class, [ + 'author' => $this->e(Author::class, ['name' => 'A2']), + 'title' => 'Some Book Title', + 'publisher' => $this->e(Publisher::class, ['name' => 'P2']), 'tags' => [ - $this->orm->tags->getBy([]), + $this->orm->tags->findAll()->orderBy('id')->fetch(), ], ]); diff --git a/tests/db/array-data.php b/tests/db/array-data.php index dd866374..8db63bc2 100644 --- a/tests/db/array-data.php +++ b/tests/db/array-data.php @@ -43,7 +43,7 @@ $book1->author = $author1; $book1->translator = $author1; $book1->publisher = $publisher1; -$book1->publishedAt = new \DateTimeImmutable('2017-04-20 20:00:00'); +$book1->publishedAt = new \DateTimeImmutable('2021-12-14 21:10:04'); $book1->price = new Money(50, Currency::CZK()); $book1->tags->set([$tag1, $tag2]); $orm->books->persist($book1); @@ -52,7 +52,7 @@ $book2->title = 'Book 2'; $book2->author = $author1; $book2->publisher = $publisher2; -$book2->publishedAt = new \DateTimeImmutable('2017-04-20 18:00:00'); +$book2->publishedAt = new \DateTimeImmutable('2021-12-14 21:10:02'); $book2->price = new Money(150, Currency::CZK()); $book2->tags->set([$tag2, $tag3]); $orm->books->persist($book2); @@ -62,7 +62,7 @@ $book3->author = $author2; $book3->translator = $author2; $book3->publisher = $publisher3; -$book3->publishedAt = new \DateTimeImmutable('2017-04-20 19:00:00'); +$book3->publishedAt = new \DateTimeImmutable('2021-12-14 21:10:03'); $book3->price = new Money(20, Currency::CZK()); $book3->tags->set([$tag3]); $orm->books->persist($book3); @@ -73,7 +73,7 @@ $book4->translator = $author2; $book4->publisher = $publisher1; $book4->nextPart = $book3; -$book4->publishedAt = new \DateTimeImmutable('2017-04-20 17:00:00'); +$book4->publishedAt = new \DateTimeImmutable('2021-12-14 21:10:01'); $book4->price = new Money(220, Currency::CZK()); $orm->books->persist($book4); diff --git a/tests/db/mssql-data.sql b/tests/db/mssql-data.sql index 9667ecd8..c7d9ecf2 100644 --- a/tests/db/mssql-data.sql +++ b/tests/db/mssql-data.sql @@ -36,14 +36,16 @@ SET IDENTITY_INSERT tags OFF; DBCC checkident ('tags', reseed, 3) WITH NO_INFOMSGS; SET IDENTITY_INSERT books ON; -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (1, 1, 1, 'Book 1', NULL, 1, DATEADD(ss, 4, CURRENT_TIMESTAMP), 50, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (2, 1, NULL, 'Book 2', NULL, 2, DATEADD(ss, 2, CURRENT_TIMESTAMP), 150, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (3, 2, 2, 'Book 3', NULL, 3, DATEADD(ss, 3, CURRENT_TIMESTAMP), 20, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (4, 2, 2, 'Book 4', 3, 1, DATEADD(ss, 1, CURRENT_TIMESTAMP), 220, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (1, 1, 1, 'Book 1', NULL, 1, '2021-12-14 21:10:04', 50, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (2, 1, NULL, 'Book 2', NULL, 2, '2021-12-14 21:10:02', 150, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (3, 2, 2, 'Book 3', NULL, 3, '2021-12-14 21:10:03', 20, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (4, 2, 2, 'Book 4', 3, 1, '2021-12-14 21:10:01', 220, 'CZK'); SET IDENTITY_INSERT books OFF; DBCC checkident ('books', reseed, 4) WITH NO_INFOMSGS; +DBCC checkident ('eans', reseed, 1) WITH NO_INFOMSGS; + INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 1); INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 2); INSERT INTO books_x_tags (book_id, tag_id) VALUES (2, 2); diff --git a/tests/db/mysql-data.sql b/tests/db/mysql-data.sql index fa7387b2..cd814b70 100644 --- a/tests/db/mysql-data.sql +++ b/tests/db/mysql-data.sql @@ -25,10 +25,10 @@ INSERT INTO tags (id, name, is_global) VALUES (1, 'Tag 1', 'y'); INSERT INTO tags (id, name, is_global) VALUES (2, 'Tag 2', 'y'); INSERT INTO tags (id, name, is_global) VALUES (3, 'Tag 3', 'n'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (1, 1, 1, 'Book 1', NULL, 1, DATE_ADD(NOW(), INTERVAL 4 SECOND), 50, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (2, 1, NULL, 'Book 2', NULL, 2, DATE_ADD(NOW(), INTERVAL 2 SECOND), 150, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (3, 2, 2, 'Book 3', NULL, 3, DATE_ADD(NOW(), INTERVAL 3 SECOND), 20, 'CZK'); -INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (4, 2, 2, 'Book 4', 3, 1, DATE_ADD(NOW(), INTERVAL 1 SECOND), 220, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (1, 1, 1, 'Book 1', NULL, 1, '2021-12-14 21:10:04', 50, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (2, 1, NULL, 'Book 2', NULL, 2, '2021-12-14 21:10:02', 150, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (3, 2, 2, 'Book 3', NULL, 3, '2021-12-14 21:10:03', 20, 'CZK'); +INSERT INTO books (id, author_id, translator_id, title, next_part, publisher_id, published_at, price, price_currency) VALUES (4, 2, 2, 'Book 4', 3, 1, '2021-12-14 21:10:01', 220, 'CZK'); INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 1); INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 2); diff --git a/tests/db/pgsql-data.sql b/tests/db/pgsql-data.sql index cc7688c7..f7382a51 100644 --- a/tests/db/pgsql-data.sql +++ b/tests/db/pgsql-data.sql @@ -33,14 +33,13 @@ INSERT INTO "tags" ("id", "name", "is_global") VALUES (3, 'Tag 3', 'n'); SELECT setval('tags_id_seq', 3, true); -INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (1, 1, 1, 'Book 1', NULL, 1, NOW() + interval '4 seconds', 50, 'CZK'); -INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (2, 1, NULL, 'Book 2', NULL, 2, NOW() + interval '2 seconds', 150, 'CZK'); -INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (3, 2, 2, 'Book 3', NULL, 3, NOW() + interval '3 seconds', 20, 'CZK'); -INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (4, 2, 2, 'Book 4', 3, 1, NOW() + interval '1 seconds', 220, 'CZK'); +INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (1, 1, 1, 'Book 1', NULL, 1, '2021-12-14 21:10:04', 50, 'CZK'); +INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (2, 1, NULL, 'Book 2', NULL, 2, '2021-12-14 21:10:02', 150, 'CZK'); +INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (3, 2, 2, 'Book 3', NULL, 3, '2021-12-14 21:10:03', 20, 'CZK'); +INSERT INTO "books" ("id", "author_id", "translator_id", "title", "next_part", "publisher_id", "published_at", "price", "price_currency") VALUES (4, 2, 2, 'Book 4', 3, 1, '2021-12-14 21:10:01', 220, 'CZK'); SELECT setval('books_id_seq', 4, true); - INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 1); INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 2); INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (2, 2); @@ -54,3 +53,10 @@ INSERT INTO "tag_followers" ("tag_id", "author_id", "created_at") VALUES (2, 2, INSERT INTO "contents" ("id", "type", "thread_id", "replied_at") VALUES (1, 'thread', NULL, NULL); INSERT INTO "contents" ("id", "type", "thread_id", "replied_at") VALUES (2, 'comment', 1, '2020-01-01 12:00:00'); INSERT INTO "contents" ("id", "type", "thread_id", "replied_at") VALUES (3, 'comment', 1, '2020-01-02 12:00:00'); + +SELECT setval('contents_id_seq', 3, true); + +ALTER SEQUENCE eans_id_seq RESTART WITH 1; +ALTER SEQUENCE photo_albums_id_seq RESTART WITH 1; +ALTER SEQUENCE photos_id_seq RESTART WITH 1; +ALTER SEQUENCE users_id_seq RESTART WITH 1; diff --git a/tests/inc/DataTestCase.php b/tests/inc/DataTestCase.php index bf348b92..16c9ad71 100644 --- a/tests/inc/DataTestCase.php +++ b/tests/inc/DataTestCase.php @@ -11,9 +11,8 @@ class DataTestCase extends TestCase { - protected function setUp() + protected function setUpData(): void { - parent::setUp(); switch ($this->section) { case Helper::SECTION_MYSQL: case Helper::SECTION_PGSQL: diff --git a/tests/inc/QueryChecker.php b/tests/inc/QueryChecker.php new file mode 100644 index 00000000..9e3ff50f --- /dev/null +++ b/tests/inc/QueryChecker.php @@ -0,0 +1,64 @@ +name = str_replace('\\', '/', $name); + } + + + public function assert(): void + { + $file = __DIR__ . '/../sqls/' . $this->name . '.sql'; + if (!file_exists($file)) { + $ci = getenv('GITHUB_ACTIONS') !== false; + if ($ci) { + throw new \Exception("Missing $this->name.sql file, run `compose tests` locally (with Postgres) to generate the expected SQL queries files."); + } + FileSystem::createDir(dirname($file)); + FileSystem::write($file, $this->sqls); + } else { + Assert::same(FileSystem::read($file), $this->sqls); + } + } + + + public function onConnect(): void + { + } + + + public function onDisconnect(): void + { + } + + + public function onQuery(string $sqlQuery, float $timeTaken, ?Result $result): void + { + if (strpos($sqlQuery, 'pg_catalog.') !== false) return; + $this->sqls .= "$sqlQuery;\n"; + } + + + public function onQueryException(string $sqlQuery, float $timeTaken, ?DriverException $exception): void + { + } +} diff --git a/tests/inc/TestCase.php b/tests/inc/TestCase.php index 031a8c9f..335c30a5 100644 --- a/tests/inc/TestCase.php +++ b/tests/inc/TestCase.php @@ -6,6 +6,7 @@ use Mockery; use Nette\Configurator; use Nette\DI\Container; +use Nextras\Dbal\IConnection; use Nextras\Orm\TestHelper\TestCaseEntityTrait; use Tester; use Tester\Environment; @@ -28,6 +29,17 @@ class TestCase extends Tester\TestCase /** @var string|null */ protected $section; + /** @var QueryChecker|null */ + private $queryChecker; + + /** @var string */ + private $testId; + + + protected function setUpData(): void + { + } + protected function setUp() { @@ -74,12 +86,33 @@ protected function setUp() } elseif ($this->section !== null) { Tester\Environment::lock("integration-$hash", TEMP_DIR); } + + $this->setUpData(); + + if ($this->section === Helper::SECTION_PGSQL) { + $this->queryChecker = new QueryChecker($this->testId); + $connection = $this->container->getByType(IConnection::class); + $connection->addLogger($this->queryChecker); + } + } + + + /** + * @param array|null $args + */ + public function runTest(string $method, array $args = null): void + { + $this->testId = get_class($this) . '_' . $method; + parent::runTest($method, $args); } protected function tearDown() { parent::tearDown(); + if ($this->queryChecker !== null) { + $this->queryChecker->assert(); + } Mockery::close(); } } diff --git a/tests/inc/model/CreatedColumnTrait.php b/tests/inc/model/CreatedColumnTrait.php index 345c6f1d..f0de8013 100644 --- a/tests/inc/model/CreatedColumnTrait.php +++ b/tests/inc/model/CreatedColumnTrait.php @@ -6,7 +6,7 @@ use DateTimeImmutable; /** - * @property DateTimeImmutable $createdAt {default now} + * @property DateTimeImmutable $createdAt {default "2021-12-02 20:21:00"} * @property-read string $createdAtFormatted {virtual} */ trait CreatedColumnTrait diff --git a/tests/inc/model/author/Author.php b/tests/inc/model/author/Author.php index 7869afda..940b7279 100644 --- a/tests/inc/model/author/Author.php +++ b/tests/inc/model/author/Author.php @@ -11,7 +11,7 @@ /** * @property int|null $id {primary} * @property string $name - * @property DateTimeImmutable|null $born {default now} + * @property DateTimeImmutable|null $born {default "2021-03-21 08:23:00"} * @property string $web {default "http://www.example.com"} * @property Author|null $favoriteAuthor {m:1 Author::$favoredBy} * @property OHM|Author[] $favoredBy {1:m Author::$favoriteAuthor} diff --git a/tests/inc/model/book/Book.php b/tests/inc/model/book/Book.php index 3917b9de..a979a77f 100644 --- a/tests/inc/model/book/Book.php +++ b/tests/inc/model/book/Book.php @@ -18,7 +18,7 @@ * @property Book|null $previousPart {1:1 Book::$nextPart} * @property Ean|null $ean {1:1 Ean::$book, isMain=true, cascade=[persist, remove]} * @property Publisher $publisher {m:1 Publisher::$books} - * @property DateTimeImmutable $publishedAt {default now} + * @property DateTimeImmutable $publishedAt {default "2021-12-31 23:59:59"} * @property DateTimeImmutable|null $printedAt * @property Money|null $price {embeddable} * @property Money|null $origPrice {embeddable} diff --git a/tests/sqls/NextrasTests/Orm/Collection/MemoryManagementTest_testMemoryLeak.sql b/tests/sqls/NextrasTests/Orm/Collection/MemoryManagementTest_testMemoryLeak.sql new file mode 100644 index 00000000..058db3b2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Collection/MemoryManagementTest_testMemoryLeak.sql @@ -0,0 +1,805 @@ +SET TIME ZONE 'UTC'; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Foobar', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testBasic.sql b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testBasic.sql new file mode 100644 index 00000000..452b51fb --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testBasic.sql @@ -0,0 +1,9 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +UPDATE "books" SET "price" = 1000, "price_currency" = 'CZK' WHERE "id" = 1; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +UPDATE "books" SET "price" = NULL, "price_currency" = NULL WHERE "id" = 1; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testMultiple.sql b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testMultiple.sql new file mode 100644 index 00000000..d9fb1c15 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testMultiple.sql @@ -0,0 +1,5 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +UPDATE "books" SET "price" = 1000, "price_currency" = 'CZK', "orig_price_cents" = 330, "orig_price_currency" = 'EUR' WHERE "id" = 1; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNonNull.sql b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNonNull.sql new file mode 100644 index 00000000..e7315df0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNonNull.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNull.sql b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNull.sql new file mode 100644 index 00000000..e7315df0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testNull.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testSetInvalid.sql b/tests/sqls/NextrasTests/Orm/Entity/EntityEmbeddableTest_testSetInvalid.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAny.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAny.sql new file mode 100644 index 00000000..cd964766 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAny.sql @@ -0,0 +1,4 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0))); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)))) temp; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0))); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_any"."id") > 0)))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAnyDependent.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAnyDependent.sql new file mode 100644 index 00000000..257610ff --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testAnyDependent.sql @@ -0,0 +1,4 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ((("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') AND ("authors"."id" = "books_any"."author_id")) LEFT JOIN "public"."authors" AS "books_translator_any" ON (("books_any"."translator_id" = "books_translator_any"."id") AND "books_translator_any"."id" IS NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_any"."id") > 0) AND (COUNT("books_translator_any"."id") > 0)); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON ((("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') AND ("authors"."id" = "books_any"."author_id")) LEFT JOIN "public"."authors" AS "books_translator_any" ON (("books_any"."translator_id" = "books_translator_any"."id") AND "books_translator_any"."id" IS NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_any"."id") > 0) AND (COUNT("books_translator_any"."id") > 0))) temp; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_count" ON (("authors"."id" = "books_count"."author_id") OR (("authors"."id" = "books_count"."author_id") AND "books_count"."price" < 100)) LEFT JOIN "public"."authors" AS "books_translator_count" ON (("books_count"."translator_id" = "books_translator_count"."id") AND "books_translator_count"."id" IS NOT NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_translator_count"."id") >= 1 AND COUNT("books_translator_count"."id") <= 1) OR (COUNT("books_count"."id") >= 1 AND COUNT("books_count"."id") <= 1)); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_count" ON (("authors"."id" = "books_count"."author_id") OR (("authors"."id" = "books_count"."author_id") AND "books_count"."price" < 100)) LEFT JOIN "public"."authors" AS "books_translator_count" ON (("books_count"."translator_id" = "books_translator_count"."id") AND "books_translator_count"."id" IS NOT NULL) GROUP BY "authors"."id", "authors"."id" HAVING ((COUNT("books_translator_count"."id") >= 1 AND COUNT("books_translator_count"."id") <= 1) OR (COUNT("books_count"."id") >= 1 AND COUNT("books_count"."id") <= 1))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testHasValueOrEmptyWithFunctions.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testHasValueOrEmptyWithFunctions.sql new file mode 100644 index 00000000..44ce3782 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testHasValueOrEmptyWithFunctions.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IN (1)) LEFT JOIN "tags" AS "tags__COUNT" ON ("books_x_tags"."tag_id" = "tags__COUNT"."id") GROUP BY "books"."id", "books"."id" HAVING (((COUNT("tags_any"."id") > 0)) OR (COUNT("tags__COUNT"."id") = 0)); +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IN (1)) LEFT JOIN "tags" AS "tags__COUNT" ON ("books_x_tags"."tag_id" = "tags__COUNT"."id") GROUP BY "books"."id", "books"."id" HAVING (((COUNT("tags_any"."id") > 0)) OR (COUNT("tags__COUNT"."id") = 0))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testIndependentSelects.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testIndependentSelects.sql new file mode 100644 index 00000000..fe16f7df --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testIndependentSelects.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ((("authors"."id" = "books_any1"."author_id") AND "books_any1"."title" = 'Book 1') AND (("authors"."id" = "books_any1"."author_id") AND "books_any1"."price" = 50)) LEFT JOIN "books" AS "books_any2" ON ((("authors"."id" = "books_any2"."author_id") AND "books_any2"."title" = 'Book 2') AND (("authors"."id" = "books_any2"."author_id") AND "books_any2"."price" = 150)) GROUP BY "authors"."id", "authors"."id", "authors"."id", "authors"."id" HAVING (((COUNT("books_any1"."id") > 0) AND (COUNT("books_any1"."id") > 0)) AND ((COUNT("books_any2"."id") > 0) AND (COUNT("books_any2"."id") > 0))); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any1" ON ((("authors"."id" = "books_any1"."author_id") AND "books_any1"."title" = 'Book 1') AND (("authors"."id" = "books_any1"."author_id") AND "books_any1"."price" = 50)) LEFT JOIN "books" AS "books_any2" ON ((("authors"."id" = "books_any2"."author_id") AND "books_any2"."title" = 'Book 2') AND (("authors"."id" = "books_any2"."author_id") AND "books_any2"."price" = 150)) GROUP BY "authors"."id", "authors"."id", "authors"."id", "authors"."id" HAVING (((COUNT("books_any1"."id") > 0) AND (COUNT("books_any1"."id") > 0)) AND ((COUNT("books_any2"."id") > 0) AND (COUNT("books_any2"."id") > 0)))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testNone.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testNone.sql new file mode 100644 index 00000000..6528c5ed --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationJoinTest_testNone.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_none" ON (("authors"."id" = "books_none"."author_id") AND "books_none"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_none"."id") = 0))); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_none" ON (("authors"."id" = "books_none"."author_id") AND "books_none"."title" = 'Book 1') GROUP BY "authors"."id" HAVING (((COUNT("books_none"."id") = 0)))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAggregationWithNoAggregateCondition.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAggregationWithNoAggregateCondition.sql new file mode 100644 index 00000000..59f66eed --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAggregationWithNoAggregateCondition.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') LEFT JOIN "tag_followers" AS "tagFollowers__COUNT" ON ("authors"."id" = "tagFollowers__COUNT"."author_id") GROUP BY "authors"."id", "authors"."id" HAVING (((COUNT("books_any"."id") > 0)) OR (COUNT("tagFollowers__COUNT"."tag_id") <= 2)); +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books_any" ON (("authors"."id" = "books_any"."author_id") AND "books_any"."title" = 'Book 1') LEFT JOIN "tag_followers" AS "tagFollowers__COUNT" ON ("authors"."id" = "tagFollowers__COUNT"."author_id") GROUP BY "authors"."id", "authors"."id" HAVING (((COUNT("books_any"."id") > 0)) OR (COUNT("tagFollowers__COUNT"."tag_id") <= 2))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvg.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvg.sql new file mode 100644 index 00000000..0959116b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvg.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__AVG" ON ("authors"."id" = "books__AVG"."author_id") GROUP BY "authors"."id" HAVING (AVG("books__AVG"."price") < 110) ORDER BY "authors"."id" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__AVG" ON ("authors"."id" = "books__AVG"."author_id") GROUP BY "authors"."id" HAVING (AVG("books__AVG"."price") <= 120) ORDER BY "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvgOnEmptyCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvgOnEmptyCollection.sql new file mode 100644 index 00000000..118a8523 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testAvgOnEmptyCollection.sql @@ -0,0 +1,5 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Test 3', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__AVG" ON ("authors"."id" = "books__AVG"."author_id") GROUP BY "authors"."id" ORDER BY AVG("books__AVG"."price") ASC NULLS FIRST, "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testCount.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testCount.sql new file mode 100644 index 00000000..5aaa93b7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testCount.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags__COUNT" ON ("books_x_tags"."tag_id" = "tags__COUNT"."id") GROUP BY "books"."id" HAVING (COUNT("tags__COUNT"."id") >= 2) ORDER BY "books"."id" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags__COUNT" ON ("books_x_tags"."tag_id" = "tags__COUNT"."id") GROUP BY "books"."id" ORDER BY COUNT("tags__COUNT"."id") ASC, "books"."id" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags__COUNT" ON ("books_x_tags"."tag_id" = "tags__COUNT"."id") GROUP BY "books"."id" ORDER BY COUNT("tags__COUNT"."id") DESC, "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMax.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMax.sql new file mode 100644 index 00000000..3c4e0985 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMax.sql @@ -0,0 +1 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MAX" ON ("authors"."id" = "books__MAX"."author_id") GROUP BY "authors"."id" HAVING (MAX("books__MAX"."price") > 150) ORDER BY "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMaxWithEmptyCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMaxWithEmptyCollection.sql new file mode 100644 index 00000000..8b1e19a3 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMaxWithEmptyCollection.sql @@ -0,0 +1,5 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Test 3', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MAX" ON ("authors"."id" = "books__MAX"."author_id") GROUP BY "authors"."id" ORDER BY MAX("books__MAX"."price") ASC NULLS FIRST, "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMin.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMin.sql new file mode 100644 index 00000000..8e1f5ae6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMin.sql @@ -0,0 +1 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MIN" ON ("authors"."id" = "books__MIN"."author_id") GROUP BY "authors"."id" HAVING (MIN("books__MIN"."price") < 50) ORDER BY "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMinWithEmptyCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMinWithEmptyCollection.sql new file mode 100644 index 00000000..ff7314fc --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testMinWithEmptyCollection.sql @@ -0,0 +1,5 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Test 3', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MIN" ON ("authors"."id" = "books__MIN"."author_id") GROUP BY "authors"."id" ORDER BY MIN("books__MIN"."price") ASC NULLS FIRST, "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testSum.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testSum.sql new file mode 100644 index 00000000..0dff1526 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionAggregationTest_testSum.sql @@ -0,0 +1 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__SUM" ON ("authors"."id" = "books__SUM"."author_id") GROUP BY "authors"."id" HAVING (SUM("books__SUM"."price") <= 200) ORDER BY "authors"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testBasics.sql new file mode 100644 index 00000000..76d854cd --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testBasics.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."price" >= 1000)); +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" WHERE (("books"."price" >= 1000))) temp; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +UPDATE "books" SET "price" = 1000, "price_currency" = 'CZK' WHERE "id" = 1; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."price" >= 1000)); +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" WHERE (("books"."price" >= 1000))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testInvalidExpression.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testInvalidExpression.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testOrderBy.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testOrderBy.sql new file mode 100644 index 00000000..a9b33d36 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionEmbeddablesTest_testOrderBy.sql @@ -0,0 +1,5 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."price" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC, "books"."price" DESC; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MAX" ON ("authors"."id" = "books__MAX"."author_id") GROUP BY "authors"."id" ORDER BY MAX("books__MAX"."price") ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" LEFT JOIN "books" AS "books__MIN" ON ("authors"."id" = "books__MIN"."author_id") GROUP BY "authors"."id" ORDER BY MIN("books__MIN"."price") ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLike.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLike.sql new file mode 100644 index 00000000..ace878c9 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLike.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book 1%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book X%')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikeCombined.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikeCombined.sql new file mode 100644 index 00000000..40679bb7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikeCombined.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" LIKE 'Book%')) AND (("books"."translator_id" IS NOT NULL))); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" LIKE 'Book 1%')) OR (("books"."translator_id" IS NULL))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikePositions.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikePositions.sql new file mode 100644 index 00000000..f76a2b04 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionLikeTest_testFilterLikePositions.sql @@ -0,0 +1,9 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book 1%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE 'Book X%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook 1')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook X')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook 1%')); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."title" LIKE '%ook X%')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCompositePK.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCompositePK.sql new file mode 100644 index 00000000..acfdac9c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCompositePK.sql @@ -0,0 +1,7 @@ +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((("tag_followers"."author_id", "tag_followers"."tag_id") IN ((2, 2)))); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (2); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((("tag_followers"."author_id", "tag_followers"."tag_id") IN ((2, 2), (1, 3)))) ORDER BY "tag_followers"."author_id" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (3, 2); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1, 2); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((NOT (("tag_followers"."author_id", "tag_followers"."tag_id") IN ((2, 2), (1, 3))))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInDifferentJoinsAndSameTable.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInDifferentJoinsAndSameTable.sql new file mode 100644 index 00000000..f131d3e7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInDifferentJoinsAndSameTable.sql @@ -0,0 +1,8 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Books 5', 1, 2, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") LEFT JOIN "public"."authors" AS "translator" ON ("books"."translator_id" = "translator"."id") WHERE (("author"."name" = 'Writer 1') AND ("translator"."web" = 'http://example.com/2')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInSameJoin.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInSameJoin.sql new file mode 100644 index 00000000..380c1d71 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testConditionsInSameJoin.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") WHERE (("author"."name" = 'Writer 1') AND ("author"."web" = 'http://example.com/1')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountInCycle.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountInCycle.sql new file mode 100644 index 00000000..f3d0da45 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountInCycle.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimited.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimited.sql new file mode 100644 index 00000000..d2c3b922 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimited.sql @@ -0,0 +1,4 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC LIMIT 1 OFFSET 1; +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC LIMIT 1 OFFSET 10; +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" ORDER BY "books"."id" ASC LIMIT 1 OFFSET 1) temp; +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" ORDER BY "books"."id" ASC LIMIT 1 OFFSET 10) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimitedWithJoin.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimitedWithJoin.sql new file mode 100644 index 00000000..fa30e3c5 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnLimitedWithJoin.sql @@ -0,0 +1,2 @@ +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") WHERE (("author"."name" = 'Writer 1')) ORDER BY "books"."id" ASC LIMIT 5) temp; +SELECT COUNT(*) AS count FROM (SELECT "tag_followers"."tag_id", "tag_followers"."author_id" FROM "tag_followers" AS "tag_followers" LEFT JOIN "tags" AS "tag" ON ("tag_followers"."tag_id" = "tag"."id") WHERE (("tag"."name" = 'Tag 1')) ORDER BY "tag_followers"."tag_id" ASC LIMIT 3) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnOrdered.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnOrdered.sql new file mode 100644 index 00000000..1d9153a6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testCountOnOrdered.sql @@ -0,0 +1 @@ +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books") temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testDistinct.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testDistinct.sql new file mode 100644 index 00000000..45913d00 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testDistinct.sql @@ -0,0 +1 @@ +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" LEFT JOIN "tags" AS "tag" ON ("tag_followers"."tag_id" = "tag"."id") LEFT JOIN "books_x_tags" AS "tag_books_x_tags" ON ("tag"."id" = "tag_books_x_tags"."tag_id") LEFT JOIN "books" AS "tag_books_any" ON (("tag_books_x_tags"."book_id" = "tag_books_any"."id") AND "tag_books_any"."id" = 1) GROUP BY "tag_followers"."tag_id", "tag_followers"."author_id" HAVING ((COUNT("tag_books_any"."id") > 0)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testEmptyArray.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testEmptyArray.sql new file mode 100644 index 00000000..76a1729e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testEmptyArray.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE ((1=0)); +SELECT "books".* FROM "books" AS "books" WHERE ((1=1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFetchChecked.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFetchChecked.sql new file mode 100644 index 00000000..848776df --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFetchChecked.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 923)); +SELECT "books".* FROM "books" AS "books"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFindByNull.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFindByNull.sql new file mode 100644 index 00000000..18ef7342 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testFindByNull.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."printed_at" IS NULL)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testJoinDifferentPath.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testJoinDifferentPath.sql new file mode 100644 index 00000000..f9c05142 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testJoinDifferentPath.sql @@ -0,0 +1,16 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 3)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('123', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 3; +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 4)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('456', 2); +SELECT CURRVAL('eans_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5', 1, NULL, 4, 2, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books" AS "nextPart" ON ("books"."next_part" = "nextPart"."id") LEFT JOIN "eans" AS "nextPart_ean" ON ("nextPart"."ean_id" = "nextPart_ean"."id") LEFT JOIN "books" AS "previousPart" ON ("books"."id" = "previousPart"."next_part") LEFT JOIN "eans" AS "previousPart_ean" ON ("previousPart"."ean_id" = "previousPart_ean"."id") WHERE (("nextPart_ean"."code" = '123') AND ("previousPart_ean"."code" = '456')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testMappingInCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testMappingInCollection.sql new file mode 100644 index 00000000..b458c70f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testMappingInCollection.sql @@ -0,0 +1,2 @@ +SELECT COUNT(*) AS count FROM (SELECT "tags"."id" FROM "tags" AS "tags" WHERE (("tags"."is_global" = 'y'))) temp; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."is_global" = 'y')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testNonNullable.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testNonNullable.sql new file mode 100644 index 00000000..90db2b13 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testNonNullable.sql @@ -0,0 +1,4 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 923)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 923)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrdering.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrdering.sql new file mode 100644 index 00000000..9a480ecc --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrdering.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") ORDER BY "author"."id" DESC, "books"."title" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") ORDER BY "author"."id" DESC, "books"."title" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingDateTimeImmutable.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingDateTimeImmutable.sql new file mode 100644 index 00000000..235626db --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingDateTimeImmutable.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."published_at" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingMultiple.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingMultiple.sql new file mode 100644 index 00000000..9a480ecc --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingMultiple.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") ORDER BY "author"."id" DESC, "books"."title" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") ORDER BY "author"."id" DESC, "books"."title" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingWithOptionalProperty.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingWithOptionalProperty.sql new file mode 100644 index 00000000..15a5bb92 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testOrderingWithOptionalProperty.sql @@ -0,0 +1,4 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "translator" ON ("books"."translator_id" = "translator"."id") ORDER BY "translator"."name" ASC NULLS FIRST, "books"."id" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "translator" ON ("books"."translator_id" = "translator"."id") ORDER BY "translator"."name" DESC, "books"."id" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "translator" ON ("books"."translator_id" = "translator"."id") ORDER BY "translator"."name" ASC, "books"."id" ASC; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "public"."authors" AS "translator" ON ("books"."translator_id" = "translator"."id") ORDER BY "translator"."name" DESC NULLS LAST, "books"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testPrimaryProxy.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testPrimaryProxy.sql new file mode 100644 index 00000000..946dbd13 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testPrimaryProxy.sql @@ -0,0 +1 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testQueryByEntity.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testQueryByEntity.sql new file mode 100644 index 00000000..a75b93bf --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testQueryByEntity.sql @@ -0,0 +1,6 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" WHERE (("books"."author_id" = 1))) temp; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" WHERE (("books"."author_id" IN (1, 2)))) temp; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" IN (1, 2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testToArrayCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testToArrayCollection.sql new file mode 100644 index 00000000..18224b04 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionTest_testToArrayCollection.sql @@ -0,0 +1,4 @@ +SELECT "authors".* FROM "public"."authors" AS "authors"; +SELECT COUNT(*) AS count FROM (SELECT "authors"."id" FROM "public"."authors" AS "authors") temp; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE "books"."author_id" IN (1)) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByDateTime.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByDateTime.sql new file mode 100644 index 00000000..de182bb8 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByDateTime.sql @@ -0,0 +1,2 @@ +SELECT COUNT(*) AS count FROM (SELECT "tag_followers"."tag_id", "tag_followers"."author_id" FROM "tag_followers" AS "tag_followers" WHERE (("tag_followers"."created_at" IN ('2014-01-01 00:10:00.000000'::timestamptz, '2014-01-02 00:10:00.000000'::timestamptz)))) temp; +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE (("tag_followers"."created_at" IN ('2014-01-01 00:10:00.000000'::timestamptz, '2014-01-02 00:10:00.000000'::timestamptz))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByPropertyWrapper.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByPropertyWrapper.sql new file mode 100644 index 00000000..d3cc10ad --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFilterByPropertyWrapper.sql @@ -0,0 +1,13 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('123', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 1; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +INSERT INTO "eans" ("code", "type") VALUES ('456', 1); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 2 WHERE "id" = 2; +COMMIT; +SELECT "eans".* FROM "eans" AS "eans"; +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."type" = 2)); +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."type" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOr.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOr.sql new file mode 100644 index 00000000..d879e4e1 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOr.sql @@ -0,0 +1,6 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."name" = 'Writer 1') OR ("authors"."web" = 'http://example.com/2')); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."name" IN ('Writer 1', 'Writer 2'))); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" = 1) AND ("books"."next_part" IS NULL)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" = 1) AND ("books"."next_part" IS NULL) AND ("books"."translator_id" IS NULL)); +SELECT "tags".* FROM "tags" AS "tags" WHERE ((("tags"."name" = 'Tag 1') AND ("tags"."is_global" = 'y')) OR (("tags"."name" = 'Tag 2') AND ("tags"."is_global" = 'n')) OR (("tags"."name" = 'Tag 3') AND ("tags"."is_global" = 'n'))); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" = 'Book 1') OR ("books"."author_id" = 1)) AND (("books"."translator_id" IS NULL) OR ("books"."next_part" = 3))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOrOldSyntax.sql b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOrOldSyntax.sql new file mode 100644 index 00000000..7da42db8 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Collection/CollectionWhereTest_testFindByAndOrOldSyntax.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" = 1) AND ("books"."next_part" IS NULL)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."author_id" = 1) AND ("books"."next_part" IS NULL) AND ("books"."translator_id" IS NULL)); +SELECT "tags".* FROM "tags" AS "tags" WHERE ((("tags"."name" = 'Tag 1') AND ("tags"."is_global" = 'y')) OR (("tags"."name" = 'Tag 2') AND ("tags"."is_global" = 'n')) OR (("tags"."name" = 'Tag 3') AND ("tags"."is_global" = 'n'))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningManyHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningManyHasMany.sql new file mode 100644 index 00000000..b16e3f10 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningManyHasMany.sql @@ -0,0 +1,18 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('New Author', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('Tag 1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('Tag 2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('Tag 3', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (5, 4), (5, 5), (5, 6); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (4, 5, 6))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (5); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningOneHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningOneHasMany.sql new file mode 100644 index 00000000..177508b2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCloningTest_testCloningOneHasMany.sql @@ -0,0 +1,13 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (1); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1', 1, 1, NULL, NULL, 1, '2021-12-14 21:10:04.000000'::timestamp, NULL, 50, 'CZK', NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (5, 1), (5, 2); +COMMIT; +SELECT "books_x_tags"."book_id", COUNT(DISTINCT "books_x_tags"."tag_id") AS "count" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5) GROUP BY "books_x_tags"."book_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testCompositePKDateTime.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testCompositePKDateTime.sql new file mode 100644 index 00000000..322fda18 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testCompositePKDateTime.sql @@ -0,0 +1,10 @@ +START TRANSACTION; +INSERT INTO "users" ("id") VALUES (1); +COMMIT; +START TRANSACTION; +INSERT INTO "user_stats" ("user_id", "date", "value") VALUES (1, '2018-09-09 08:09:02.000000'::timestamptz, 100); +COMMIT; +SELECT "user_stats".* FROM "user_stats" AS "user_stats" WHERE (("user_stats"."user_id" = 1) AND ("user_stats"."date" = '2018-09-09 08:09:02.000000'::timestamptz)); +START TRANSACTION; +UPDATE "user_stats" SET "value" = 101 WHERE "user_id" = 1 AND "date" = '2018-09-09 08:09:02.000000'::timestamptz; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetBy.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetBy.sql new file mode 100644 index 00000000..95a0ac7c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetBy.sql @@ -0,0 +1,4 @@ +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE (("tag_followers"."tag_id" = 3) AND ("tag_followers"."author_id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (3); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE (("tag_followers"."author_id" = 1) AND ("tag_followers"."tag_id" = 3)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetById.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetById.sql new file mode 100644 index 00000000..d7974b99 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetById.sql @@ -0,0 +1,4 @@ +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((("tag_followers"."author_id", "tag_followers"."tag_id") IN ((1, 3)))); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (3); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((("tag_followers"."author_id", "tag_followers"."tag_id") IN ((3, 1)))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetByIdWronglyUsedWithIndexedKeys.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testGetByIdWronglyUsedWithIndexedKeys.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testSetIdOnlyPartially.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testSetIdOnlyPartially.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testSetIdWithInsufficientParameters.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityCompositePKTest_testSetIdWithInsufficientParameters.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPkTest_testDateTimeWithProxyPk.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPkTest_testDateTimeWithProxyPk.sql new file mode 100644 index 00000000..8ffa6c23 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPkTest_testDateTimeWithProxyPk.sql @@ -0,0 +1,6 @@ +START TRANSACTION; +INSERT INTO "logs" ("date", "count") VALUES ('2022-03-06 03:03:03.000000'::timestamptz, 3); +COMMIT; +START TRANSACTION; +UPDATE "logs" SET "count" = 5 WHERE "date" = '2022-03-06 03:03:03.000000'; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testCombination.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testCombination.sql new file mode 100644 index 00000000..6e0f7893 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testCombination.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books"; +SELECT "books".* FROM "books" AS "books"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testWithEntityWithInvalidRelationshipState.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testWithEntityWithInvalidRelationshipState.sql new file mode 100644 index 00000000..45f61e8e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntityPreloadContainerTest_testWithEntityWithInvalidRelationshipState.sql @@ -0,0 +1,7 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (1); +START TRANSACTION; +DELETE FROM "tag_followers" WHERE "author_id" = 1 AND "tag_id" = 1; +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (3); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/EntitySetReadOnlyValueTest_testWithIPropertyWrapper.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntitySetReadOnlyValueTest_testWithIPropertyWrapper.sql new file mode 100644 index 00000000..f5a24e66 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/EntitySetReadOnlyValueTest_testWithIPropertyWrapper.sql @@ -0,0 +1,2 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 2)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testDuplicatePrimaryKey.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testDuplicatePrimaryKey.sql new file mode 100644 index 00000000..0f8804b1 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testDuplicatePrimaryKey.sql @@ -0,0 +1,8 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("id", "name", "born", "web", "favorite_author_id") VALUES (444, 'Jon Snow', '2021-03-21 08:23:00.000000'::timestamp, 'http://nextras.cz', NULL); +COMMIT; +START TRANSACTION; +ROLLBACK; +START TRANSACTION; +INSERT INTO "public"."authors" ("id", "name", "born", "web", "favorite_author_id") VALUES (445, 'The Imp', '2021-03-21 08:23:00.000000'::timestamp, 'http://nextras.cz/imp', NULL); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsert.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsert.sql new file mode 100644 index 00000000..56064c26 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsert.sql @@ -0,0 +1,4 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Jon Snow', '2021-03-21 08:23:00.000000'::timestamp, 'http://nextras.cz', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsertWithPrimaryKey.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsertWithPrimaryKey.sql new file mode 100644 index 00000000..9e4da80b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/NewEntityTest_testInsertWithPrimaryKey.sql @@ -0,0 +1,4 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("id", "name", "born", "web", "favorite_author_id") VALUES (555, 'Jon Snow', '2021-03-21 08:23:00.000000'::timestamp, 'http://nextras.cz', NULL); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 555)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Entity/UpdateEntityTest_testUpdate.sql b/tests/sqls/NextrasTests/Orm/Integration/Entity/UpdateEntityTest_testUpdate.sql new file mode 100644 index 00000000..1fc809f9 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Entity/UpdateEntityTest_testUpdate.sql @@ -0,0 +1,4 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +START TRANSACTION; +UPDATE "public"."authors" SET "name" = 'Test Testcase' WHERE "id" = 1; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Mapper/ConventionsTest_testTimezoneDetection.sql b/tests/sqls/NextrasTests/Orm/Integration/Mapper/ConventionsTest_testTimezoneDetection.sql new file mode 100644 index 00000000..b855c12f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Mapper/ConventionsTest_testTimezoneDetection.sql @@ -0,0 +1,9 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('P'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('B', 3, NULL, NULL, NULL, 4, '2015-09-09 10:10:10.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 5)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Mapper/DbalPersistAutoupdateMapperTest_testInsertAndUpdate.sql b/tests/sqls/NextrasTests/Orm/Integration/Mapper/DbalPersistAutoupdateMapperTest_testInsertAndUpdate.sql new file mode 100644 index 00000000..c00ce58c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Mapper/DbalPersistAutoupdateMapperTest_testInsertAndUpdate.sql @@ -0,0 +1,9 @@ +START TRANSACTION; +INSERT INTO "book_collections" ("id", "name", "updated_at") VALUES (99, 'Test Collection 1', NULL) RETURNING "id", "updated_at"; +COMMIT; +START TRANSACTION; +UPDATE "book_collections" SET "name" = 'Test Collection 11' WHERE "id" = 99 RETURNING "id", "updated_at"; +COMMIT; +DELETE FROM book_collections WHERE id = 99; +START TRANSACTION; +UPDATE "book_collections" SET "name" = 'Test Collection 112' WHERE "id" = 99 RETURNING "id", "updated_at"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperDateTimeSimpleTest_testToCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperDateTimeSimpleTest_testToCollection.sql new file mode 100644 index 00000000..7063b95f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperDateTimeSimpleTest_testToCollection.sql @@ -0,0 +1,5 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Random Author', '2018-01-09 00:00:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 3)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToCollection.sql new file mode 100644 index 00000000..2be04c3d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToCollection.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE id % 2 = 0; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToEntity.sql b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToEntity.sql new file mode 100644 index 00000000..46888ad0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Mapper/MapperSelectionTest_testToEntity.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE id = 1; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelClearTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelClearTest_testBasics.sql new file mode 100644 index 00000000..4a596b2e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelClearTest_testBasics.sql @@ -0,0 +1,4 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testAllowOverwrite.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testAllowOverwrite.sql new file mode 100644 index 00000000..3f0b4800 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testAllowOverwrite.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testBasics.sql new file mode 100644 index 00000000..8e96747d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testBasics.sql @@ -0,0 +1,5 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +UPDATE "books" SET "title" = 'foo' WHERE id = 1; +UPDATE "books" SET "title" = 'bar' WHERE id = 2; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDelete.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDelete.sql new file mode 100644 index 00000000..46c0ecb9 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDelete.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +DELETE FROM "books" WHERE id = 1; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDisallowOverwrite.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDisallowOverwrite.sql new file mode 100644 index 00000000..e7315df0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testDisallowOverwrite.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations.sql new file mode 100644 index 00000000..36ff101b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +DELETE FROM "books_x_tags" WHERE book_id = 2 AND tag_id = 3; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2))); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations2.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations2.sql new file mode 100644 index 00000000..0c4c4ac6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testMHMRelations2.sql @@ -0,0 +1,8 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 3)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2, 3))); +DELETE FROM "books_x_tags" WHERE book_id = 2 AND tag_id = 3; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2, 3))); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (3))); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (3))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHMRelations.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHMRelations.sql new file mode 100644 index 00000000..5dc6a2c2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHMRelations.sql @@ -0,0 +1,11 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 2)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (2); +UPDATE "books" SET "publisher_id" = 2 WHERE id = 1; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2, 4))); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" IN (1, 2))); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (2, 1); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1, 2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHORelations.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHORelations.sql new file mode 100644 index 00000000..51a203de --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testOHORelations.sql @@ -0,0 +1,11 @@ +INSERT INTO "eans" ("id", "code", "type") VALUES (1, '111', 2); +UPDATE "books" SET "ean_id" = 1 WHERE id = 1; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."id" = 1)); +SELECT "eans".* FROM "eans" AS "eans" WHERE "eans"."id" IN (1); +INSERT INTO "eans" ("id", "code", "type") VALUES (2, '222', 2); +UPDATE "books" SET "ean_id" = 2 WHERE id = 1; +DELETE FROM "eans" WHERE id = 1; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."id" IN (1))); +SELECT "eans".* FROM "eans" AS "eans" WHERE "eans"."id" IN (2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedMHM.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedMHM.sql new file mode 100644 index 00000000..b066229b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedMHM.sql @@ -0,0 +1,13 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 3)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2, 3))); +START TRANSACTION; +UPDATE "books" SET "title" = 'abc' WHERE "id" = 2; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2, 3))); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (3))); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (2, 3))); +START TRANSACTION; +UPDATE "books" SET "title" = 'xyz' WHERE "id" = 2; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedOHM.sql b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedOHM.sql new file mode 100644 index 00000000..01531b49 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Model/ModelRefreshAllTest_testTrackedOHM.sql @@ -0,0 +1,11 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1); +START TRANSACTION; +UPDATE "books" SET "title" = 'abc' WHERE "id" = 1; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 4))); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" IN (1))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1); +START TRANSACTION; +UPDATE "books" SET "title" = 'xyz' WHERE "id" = 1; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testBasics.sql new file mode 100644 index 00000000..19a932b7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testBasics.sql @@ -0,0 +1,14 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Jon Snow', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('7K'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('A new book', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('Awesome', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (5, 4); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (4))); +SELECT "books_x_tags"."book_id", COUNT(DISTINCT "books_x_tags"."tag_id") AS "count" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5) GROUP BY "books_x_tags"."book_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalHasOne.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalHasOne.sql new file mode 100644 index 00000000..f9304f7b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalHasOne.sql @@ -0,0 +1,4 @@ +SELECT "tags".* FROM "tags" AS "tags"; +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (1, 2, 3); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2, 3))); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1, 2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalManyHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalManyHasMany.sql new file mode 100644 index 00000000..d4e60498 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testDeepTraversalManyHasMany.sql @@ -0,0 +1,4 @@ +SELECT "authors".* FROM "public"."authors" AS "authors"; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1, 2) ORDER BY "books"."id" DESC; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (4, 3, 2, 1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 3))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testSetRelationships.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/EntityRelationshipsTest_testSetRelationships.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testCycleCheck.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testCycleCheck.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testCycleManualPersist.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testCycleManualPersist.sql new file mode 100644 index 00000000..1f73f795 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testCycleManualPersist.sql @@ -0,0 +1,10 @@ +START TRANSACTION; +INSERT INTO "photo_albums" ("title", "preview_id") VALUES ('album 1', NULL); +SELECT CURRVAL('photo_albums_id_seq'); +INSERT INTO "photos" ("title", "album_id") VALUES ('photo 1', 1); +SELECT CURRVAL('photos_id_seq'); +INSERT INTO "photos" ("title", "album_id") VALUES ('photo 2', 1); +SELECT CURRVAL('photos_id_seq'); +INSERT INTO "photos" ("title", "album_id") VALUES ('photo 3', 1); +SELECT CURRVAL('photos_id_seq'); +UPDATE "photo_albums" SET "preview_id" = 2 WHERE "id" = 1; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testNotCycle.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testNotCycle.sql new file mode 100644 index 00000000..85ec410e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipCyclicTest_testNotCycle.sql @@ -0,0 +1,9 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Dave Lister', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Arnold Judas Rimmer', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', 3); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Jupiter Mining Corporation'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Better Than Life', 4, 3, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCache.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCache.sql new file mode 100644 index 00000000..fb03c9de --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCache.sql @@ -0,0 +1,7 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" != 'Tag 1'))) AND ("books_x_tags"."book_id" IN (1)) ORDER BY "tags"."id" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); +SELECT "books_x_tags"."book_id", COUNT(DISTINCT "books_x_tags"."tag_id") AS "count" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" != 'Tag 1'))) AND ("books_x_tags"."book_id" IN (1)) GROUP BY "books_x_tags"."book_id"; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" != 'Tag 3'))) AND ("books_x_tags"."book_id" IN (1)) ORDER BY "tags"."id" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books_x_tags"."book_id", COUNT(DISTINCT "books_x_tags"."tag_id") AS "count" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" != 'Tag 3'))) AND ("books_x_tags"."book_id" IN (1)) GROUP BY "books_x_tags"."book_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCaching.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCaching.sql new file mode 100644 index 00000000..cbafac1a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCaching.sql @@ -0,0 +1,7 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" = 'Tag 1'))) AND ("books_x_tags"."book_id" IN (1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1))); +START TRANSACTION; +UPDATE "tags" SET "name" = 'XXX' WHERE "id" = 1; +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."name" = 'Tag 1'))) AND ("books_x_tags"."book_id" IN (1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCachingPreload.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCachingPreload.sql new file mode 100644 index 00000000..158ec07f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCachingPreload.sql @@ -0,0 +1,9 @@ +SELECT "books".* FROM "books" AS "books"; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1, 2, 3, 4); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 3))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."id" = 1))) AND ("books_x_tags"."book_id" IN (2)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."id" = 2))) AND ("books_x_tags"."book_id" IN (2)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."id" = 3))) AND ("books_x_tags"."book_id" IN (2)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (3))); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 4)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCollectionCountWithLimit.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCollectionCountWithLimit.sql new file mode 100644 index 00000000..cbb8300f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCollectionCountWithLimit.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +(SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 1 ORDER BY "tags"."id" ASC LIMIT 1 OFFSET 1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountAfterRemoveAndFlushAndCount.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountAfterRemoveAndFlushAndCount.sql new file mode 100644 index 00000000..f1cef99d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountAfterRemoveAndFlushAndCount.sql @@ -0,0 +1,26 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('Testing Tag', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall', 1, 1, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (5, 4); +COMMIT; +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (4); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (5))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (4))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (5); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((5, 4)); +DELETE FROM "books" WHERE "id" = 5; +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (4); +COMMIT; +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (4); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall III', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (6, 4); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (4); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (6))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyHasManyRelationshipCondition.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyHasManyRelationshipCondition.sql new file mode 100644 index 00000000..088f7119 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyHasManyRelationshipCondition.sql @@ -0,0 +1,7 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE ((("author"."id" = 1))) AND ("books_x_tags"."tag_id" IN (1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); +SELECT "books_x_tags"."tag_id", COUNT(DISTINCT "books_x_tags"."book_id") AS "count" FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE ((("author"."id" = 1))) AND ("books_x_tags"."tag_id" IN (1)) GROUP BY "books_x_tags"."tag_id"; +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") LEFT JOIN "tag_followers" AS "author_tagFollowers_any" ON ("author"."id" = "author_tagFollowers_any"."author_id") LEFT JOIN "public"."authors" AS "author_tagFollowers_author_any" ON (("author_tagFollowers_any"."author_id" = "author_tagFollowers_author_any"."id") AND "author_tagFollowers_author_any"."id" = 1) LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (1) GROUP BY "books"."id", "books_x_tags"."book_id", "books_x_tags"."tag_id" HAVING ((COUNT("author_tagFollowers_author_any"."id") > 0)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); +SELECT "books_x_tags"."tag_id", COUNT(DISTINCT "books_x_tags"."book_id") AS "count" FROM "books" AS "books" LEFT JOIN "public"."authors" AS "author" ON ("books"."author_id" = "author"."id") LEFT JOIN "tag_followers" AS "author_tagFollowers_any" ON ("author"."id" = "author_tagFollowers_any"."author_id") LEFT JOIN "public"."authors" AS "author_tagFollowers_author_any" ON (("author_tagFollowers_any"."author_id" = "author_tagFollowers_author_any"."id") AND "author_tagFollowers_author_any"."id" = 1) LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (1) GROUP BY "books"."id", "books_x_tags"."tag_id" HAVING ((COUNT("author_tagFollowers_author_any"."id") > 0)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyToManyCondition.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyToManyCondition.sql new file mode 100644 index 00000000..0c2da4ab --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCountStoredOnManyToManyCondition.sql @@ -0,0 +1 @@ +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."name" = 'Tag 2') GROUP BY "books"."id" HAVING ((COUNT("tags_any"."id") > 0))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testEmptyPreloadContainer.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testEmptyPreloadContainer.sql new file mode 100644 index 00000000..8261cea2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testEmptyPreloadContainer.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1) ORDER BY "tags"."name" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (2) ORDER BY "tags"."name" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (3) ORDER BY "tags"."name" ASC; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (3))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (4) ORDER BY "tags"."name" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testIsModified.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testIsModified.sql new file mode 100644 index 00000000..94ac8a5c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testIsModified.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testJoinAcrossDifferentPaths.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testJoinAcrossDifferentPaths.sql new file mode 100644 index 00000000..4ff5002d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testJoinAcrossDifferentPaths.sql @@ -0,0 +1,7 @@ +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."name" = 'Tag 1') LEFT JOIN "books" AS "nextPart" ON ("books"."next_part" = "nextPart"."id") LEFT JOIN "books_x_tags" AS "nextPart_books_x_tags" ON ("nextPart"."id" = "nextPart_books_x_tags"."book_id") LEFT JOIN "tags" AS "nextPart_tags_any" ON (("nextPart_books_x_tags"."tag_id" = "nextPart_tags_any"."id") AND "nextPart_tags_any"."name" = 'Tag 3') GROUP BY "books"."id", "books"."id" HAVING ((COUNT("tags_any"."id") > 0) OR (COUNT("nextPart_tags_any"."id") > 0)) ORDER BY "books"."id" ASC; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('Tag 5', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (4, 4); +COMMIT; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."name" = 'Tag 5') LEFT JOIN "books" AS "nextPart" ON ("books"."next_part" = "nextPart"."id") LEFT JOIN "books_x_tags" AS "nextPart_books_x_tags" ON ("nextPart"."id" = "nextPart_books_x_tags"."book_id") LEFT JOIN "tags" AS "nextPart_tags_any" ON (("nextPart_books_x_tags"."tag_id" = "nextPart_tags_any"."id") AND "nextPart_tags_any"."name" = 'Tag 3') GROUP BY "books"."id", "books"."id" HAVING ((COUNT("tags_any"."id") > 0) AND (COUNT("nextPart_tags_any"."id") > 0)) ORDER BY "books"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testLimit.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testLimit.sql new file mode 100644 index 00000000..21cc3a19 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testLimit.sql @@ -0,0 +1,9 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 3)); +START TRANSACTION; +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 3); +COMMIT; +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC; +(SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 1 ORDER BY "tags"."name" DESC LIMIT 2) UNION ALL (SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 2 ORDER BY "tags"."name" DESC LIMIT 2) UNION ALL (SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 3 ORDER BY "tags"."name" DESC LIMIT 2) UNION ALL (SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 4 ORDER BY "tags"."name" DESC LIMIT 2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +(SELECT 1 AS "book_id", COUNT(*) AS "count" FROM (SELECT "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "book_id" = 1 LIMIT 2) "temp") UNION ALL (SELECT 2 AS "book_id", COUNT(*) AS "count" FROM (SELECT "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "book_id" = 2 LIMIT 2) "temp") UNION ALL (SELECT 3 AS "book_id", COUNT(*) AS "count" FROM (SELECT "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "book_id" = 3 LIMIT 2) "temp") UNION ALL (SELECT 4 AS "book_id", COUNT(*) AS "count" FROM (SELECT "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "book_id" = 4 LIMIT 2) "temp"); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRawValue.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRawValue.sql new file mode 100644 index 00000000..a24f2695 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRawValue.sql @@ -0,0 +1,18 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."id" NOT IN (1)))) AND ("books_x_tags"."book_id" IN (1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('Test tag', 'y'); +SELECT CURRVAL('tags_id_seq'); +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 1)); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 4))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE ((("tags"."id" NOT IN (2, 4)))) AND ("books_x_tags"."book_id" IN (1)); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 2), (1, 4)); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRemove.sql new file mode 100644 index 00000000..74837084 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRemove.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 1)); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); +SELECT "books_x_tags"."book_id", COUNT(DISTINCT "books_x_tags"."tag_id") AS "count" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1) GROUP BY "books_x_tags"."book_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRepeatedPersisting.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRepeatedPersisting.sql new file mode 100644 index 00000000..bd6ff57b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testRepeatedPersisting.sql @@ -0,0 +1,11 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('A', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('B', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4), (1, 5); +COMMIT; +START TRANSACTION; +UPDATE "tags" SET "name" = 'X' WHERE "id" = 4; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSelfReferencing.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSelfReferencing.sql new file mode 100644 index 00000000..92ae3ece --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSelfReferencing.sql @@ -0,0 +1,10 @@ +START TRANSACTION; +INSERT INTO "users" ("id") VALUES (123); +COMMIT; +START TRANSACTION; +INSERT INTO "users" ("id") VALUES (124); +INSERT INTO "users_x_users" ("my_friends_id", "friends_with_me_id") VALUES (124, 123); +COMMIT; +SELECT "users_x_users"."my_friends_id", "users_x_users"."friends_with_me_id" FROM "users" AS "users" LEFT JOIN "users_x_users" AS "users_x_users" ON ("users_x_users"."my_friends_id" = "users"."id") WHERE "users_x_users"."friends_with_me_id" IN (123); +SELECT "users".* FROM "users" AS "users" WHERE (("users"."id" IN (124))); +SELECT "users_x_users"."friends_with_me_id", "users_x_users"."my_friends_id" FROM "users" AS "users" LEFT JOIN "users_x_users" AS "users_x_users" ON ("users_x_users"."friends_with_me_id" = "users"."id") WHERE "users_x_users"."my_friends_id" IN (123); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSymmetricRelationship.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSymmetricRelationship.sql new file mode 100644 index 00000000..7389d19a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testSymmetricRelationship.sql @@ -0,0 +1,5 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (2); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testAutoConnection.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testAutoConnection.sql new file mode 100644 index 00000000..f631603e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testAutoConnection.sql @@ -0,0 +1,3 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testBasics.sql new file mode 100644 index 00000000..edbcede2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testBasics.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1, 2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testCache.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testCache.sql new file mode 100644 index 00000000..bafbbd88 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testCache.sql @@ -0,0 +1,5 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (2) ORDER BY "books"."id" DESC LIMIT 1; +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (2) ORDER BY "books"."id" DESC; +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1, 3); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testEmptyEntityPreloadContainer.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testEmptyEntityPreloadContainer.sql new file mode 100644 index 00000000..8d659464 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testEmptyEntityPreloadContainer.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" ORDER BY "books"."id" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testHasValue.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testHasValue.sql new file mode 100644 index 00000000..e7315df0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testHasValue.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testPersistenceHasOne.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testPersistenceHasOne.sql new file mode 100644 index 00000000..9abc5ad4 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testPersistenceHasOne.sql @@ -0,0 +1,7 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Jon Snow', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('A new book', 3, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testTranslator.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testTranslator.sql new file mode 100644 index 00000000..39ee59d0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipManyHasOneTest_testTranslator.sql @@ -0,0 +1,2 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" > 1)) ORDER BY "books"."id" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testHasMany.sql new file mode 100644 index 00000000..99f4f6fa --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testHasMany.sql @@ -0,0 +1,3 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (1); +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "tag_followers".*, "tag_followers"."tag_id" AS "count" FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (1)) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testLimit.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testLimit.sql new file mode 100644 index 00000000..3c13962f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testLimit.sql @@ -0,0 +1,8 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 2)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +START TRANSACTION; +INSERT INTO "tag_followers" ("created_at", "author_id", "tag_id") VALUES ('2021-12-02 19:21:00.000000'::timestamptz, 1, 2); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" ORDER BY "authors"."id" ASC; +(SELECT "tag_followers".*, "tag_followers"."author_id", "tag_followers"."tag_id" FROM "tag_followers" AS "tag_followers" WHERE "author_id" = 1 ORDER BY "tag_followers"."tag_id" DESC LIMIT 2) UNION ALL (SELECT "tag_followers".*, "tag_followers"."author_id", "tag_followers"."tag_id" FROM "tag_followers" AS "tag_followers" WHERE "author_id" = 2 ORDER BY "tag_followers"."tag_id" DESC LIMIT 2); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ("tag_followers"."author_id", "tag_followers"."tag_id") IN ((1, 3), (1, 2), (2, 2)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testRemoveHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testRemoveHasMany.sql new file mode 100644 index 00000000..84cd8ae2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyCompositePkTest_testRemoveHasMany.sql @@ -0,0 +1,8 @@ +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE (("tag_followers"."tag_id" = 3) AND ("tag_followers"."author_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (3); +START TRANSACTION; +DELETE FROM "tag_followers" WHERE "author_id" = 1 AND "tag_id" = 3; +COMMIT; +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (1); +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "tag_followers".*, "tag_followers"."tag_id" AS "count" FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (1)) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollection.sql new file mode 100644 index 00000000..344cb1de --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollection.sql @@ -0,0 +1,14 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('B', 3, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (5); +START TRANSACTION; +DELETE FROM "books" WHERE "id" = 5; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollectionAndParent.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollectionAndParent.sql new file mode 100644 index 00000000..14076e2d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveCollectionAndParent.sql @@ -0,0 +1,18 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('B', 3, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (5); +START TRANSACTION; +DELETE FROM "books" WHERE "id" = 5; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (3); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."favorite_author_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE "books"."translator_id" IN (3); +DELETE FROM "public"."authors" WHERE "id" = 3; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveItem.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveItem.sql new file mode 100644 index 00000000..b2f6a6e2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveItem.sql @@ -0,0 +1,7 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 3)); +START TRANSACTION; +UPDATE "books" SET "translator_id" = NULL WHERE "id" = 3; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."translator_id" IN (2); +SELECT "translator_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE "books"."translator_id" IN (2)) AS "temp" GROUP BY "translator_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveNoCascadeEmptyCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveNoCascadeEmptyCollection.sql new file mode 100644 index 00000000..b47a0adc --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyRemoveTest_testRemoveNoCascadeEmptyCollection.sql @@ -0,0 +1,11 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (3); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."favorite_author_id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "books".* FROM "books" AS "books" WHERE "books"."translator_id" IN (3); +START TRANSACTION; +DELETE FROM "public"."authors" WHERE "id" = 3; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testBasics.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testBasics.sql new file mode 100644 index 00000000..1c36211f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testBasics.sql @@ -0,0 +1,7 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" != 'Book 1'))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."title" != 'Book 1'))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" != 'Book 3'))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."title" != 'Book 3'))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."title" != 'Book 3'))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" ASC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."title" != 'Book 3'))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCachingBasic.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCachingBasic.sql new file mode 100644 index 00000000..bd262844 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCachingBasic.sql @@ -0,0 +1,6 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."translator_id" IS NULL))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +START TRANSACTION; +UPDATE "books" SET "translator_id" = 1 WHERE "id" = 2; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."translator_id" IS NULL))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountAfterRemoveAndFlushAndCount.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountAfterRemoveAndFlushAndCount.sql new file mode 100644 index 00000000..921eb2ef --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountAfterRemoveAndFlushAndCount.sql @@ -0,0 +1,20 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('The Imp', '2000-01-01 12:12:12.000000'::timestamp, 'localhost', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Valyria'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall', 3, 3, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (5); +START TRANSACTION; +DELETE FROM "books" WHERE "id" = 5; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall III', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountOnCompositePkInTargetTable.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountOnCompositePkInTargetTable.sql new file mode 100644 index 00000000..6f77df36 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountOnCompositePkInTargetTable.sql @@ -0,0 +1,7 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +INSERT INTO "tag_followers" ("created_at", "author_id", "tag_id") VALUES ('2021-12-02 19:21:00.000000'::timestamptz, 2, 1); +COMMIT; +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "tag_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "tag_followers".*, "tag_followers"."author_id" AS "count" FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."tag_id" IN (1)) AS "temp" GROUP BY "tag_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountStoredOnOneHasManyRelationshipCondition.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountStoredOnOneHasManyRelationshipCondition.sql new file mode 100644 index 00000000..aa08fd91 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testCountStoredOnOneHasManyRelationshipCondition.sql @@ -0,0 +1,3 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "publisher_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" = 1) WHERE "books"."publisher_id" IN (1) GROUP BY "books"."id" HAVING ((COUNT("tags_any"."id") > 0))) AS "temp" GROUP BY "publisher_id"; +SELECT "publisher_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" = 1) WHERE "books"."publisher_id" IN (1) GROUP BY "books"."id" HAVING (("books"."title" = 'Book 1') OR (COUNT("tags_any"."id") > 0))) AS "temp" GROUP BY "publisher_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testDefaultOrderingOnEmptyCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testDefaultOrderingOnEmptyCollection.sql new file mode 100644 index 00000000..e69de29b diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testEmptyEntityPreloadContainer.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testEmptyEntityPreloadContainer.sql new file mode 100644 index 00000000..1e0733ab --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testEmptyEntityPreloadContainer.sql @@ -0,0 +1,3 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" ORDER BY "authors"."id" ASC; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (2) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testLimit.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testLimit.sql new file mode 100644 index 00000000..b00b3905 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testLimit.sql @@ -0,0 +1,10 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors" ORDER BY "authors"."id" ASC; +(SELECT "books".*, "books"."id", "books"."author_id" FROM "books" AS "books" WHERE "author_id" = 1 ORDER BY "books"."title" DESC LIMIT 2) UNION ALL (SELECT "books".*, "books"."id", "books"."author_id" FROM "books" AS "books" WHERE "author_id" = 2 ORDER BY "books"."title" DESC LIMIT 2); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (5, 2, 4, 3))); +(SELECT 1 AS "author_id", COUNT(*) AS "count" FROM (SELECT "books"."author_id" FROM "books" AS "books" WHERE "books"."author_id" = 1 LIMIT 2) "temp") UNION ALL (SELECT 2 AS "author_id", COUNT(*) AS "count" FROM (SELECT "books"."author_id" FROM "books" AS "books" WHERE "books"."author_id" = 2 LIMIT 2) "temp"); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testOrderingWithJoins.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testOrderingWithJoins.sql new file mode 100644 index 00000000..146e4df0 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testOrderingWithJoins.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books".* FROM "books" AS "books" LEFT JOIN "eans" AS "ean" ON ("books"."ean_id" = "ean"."id") WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC, "ean"."code" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testPersistence.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testPersistence.sql new file mode 100644 index 00000000..1c24acbe --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testPersistence.sql @@ -0,0 +1,25 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A1', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A2', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3', 4, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4', 4, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A3', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5', 5, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6', 5, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (4) ORDER BY "books"."id" DESC; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (5) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testRawValue.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testRawValue.sql new file mode 100644 index 00000000..658062ad --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testRawValue.sql @@ -0,0 +1,16 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (1); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 1), (1, 2)); +DELETE FROM "books" WHERE "id" = 1; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Test book', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testSameTableJoinWithImplicitAggregation.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testSameTableJoinWithImplicitAggregation.sql new file mode 100644 index 00000000..38918f42 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testSameTableJoinWithImplicitAggregation.sql @@ -0,0 +1,2 @@ +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON ((("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IN (1)) OR (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IS NULL)) GROUP BY "books"."id", "books"."id" HAVING (((COUNT("tags_any"."id") > 0)) OR ((COUNT("tags_any"."id") > 0)))) temp; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books"."id" = "books_x_tags"."book_id") LEFT JOIN "tags" AS "tags_any" ON ((("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IN (1)) OR (("books_x_tags"."tag_id" = "tags_any"."id") AND "tags_any"."id" IS NULL)) GROUP BY "books"."id", "books"."id" HAVING (((COUNT("tags_any"."id") > 0)) OR ((COUNT("tags_any"."id") > 0))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testUniqueConstraintException.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testUniqueConstraintException.sql new file mode 100644 index 00000000..7adb04c6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testUniqueConstraintException.sql @@ -0,0 +1,14 @@ +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 2)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +ROLLBACK; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +START TRANSACTION; +INSERT INTO "tag_followers" ("created_at", "author_id", "tag_id") VALUES ('2021-12-02 19:21:00.000000'::timestamptz, 1, 2); +COMMIT; +SELECT author_id FROM tag_followers WHERE tag_id = 2 ORDER BY author_id; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" IN (1, 2))); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2))); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE ((("tag_followers"."author_id", "tag_followers"."tag_id") IN ((1, 2)))); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."tag_id" IN (2) ORDER BY "tag_followers"."author_id" ASC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1, 2); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testWithDifferentPrimaryKey.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testWithDifferentPrimaryKey.sql new file mode 100644 index 00000000..e1987a8a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasManyTest_testWithDifferentPrimaryKey.sql @@ -0,0 +1,2 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemove.sql new file mode 100644 index 00000000..3dee8bce --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemove.sql @@ -0,0 +1,19 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 1; +COMMIT; +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."ean_id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (1); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 1), (1, 2)); +DELETE FROM "books" WHERE "id" = 1; +DELETE FROM "eans" WHERE "id" = 1; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemoveWithNull.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemoveWithNull.sql new file mode 100644 index 00000000..8871af7c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCascadeRemoveWithNull.sql @@ -0,0 +1,8 @@ +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."ean_id" IN (1); +START TRANSACTION; +DELETE FROM "eans" WHERE "id" = 1; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCollection.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCollection.sql new file mode 100644 index 00000000..3b6cd528 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testCollection.sql @@ -0,0 +1,10 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('GoTEAN', 2); +SELECT CURRVAL('eans_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('GoT', 1, NULL, NULL, 1, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT COUNT(*) AS count FROM (SELECT "eans"."id" FROM "eans" AS "eans" LEFT JOIN "books" AS "book" ON ("eans"."id" = "book"."ean_id") WHERE (("book"."title" = 'GoT'))) temp; +SELECT "eans".* FROM "eans" AS "eans" LEFT JOIN "books" AS "book" ON ("eans"."id" = "book"."ean_id") WHERE (("book"."title" = 'GoT')) ORDER BY "book"."title" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testGetRawValue.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testGetRawValue.sql new file mode 100644 index 00000000..d4693369 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testGetRawValue.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 1; +COMMIT; +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."ean_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testHasValue.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testHasValue.sql new file mode 100644 index 00000000..af8ce01f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testHasValue.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 1; +COMMIT; +SELECT "eans".* FROM "eans" AS "eans" WHERE (("eans"."code" = '1234')); +SELECT "books".* FROM "books" AS "books" WHERE "books"."ean_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistence.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistence.sql new file mode 100644 index 00000000..62255f86 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistence.sql @@ -0,0 +1,10 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Games of Thrones II', 2, NULL, NULL, NULL, 2, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Games of Thrones I', 1, NULL, 5, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistenceFromOtherSide.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistenceFromOtherSide.sql new file mode 100644 index 00000000..62255f86 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testPersistenceFromOtherSide.sql @@ -0,0 +1,10 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Games of Thrones II', 2, NULL, NULL, NULL, 2, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Games of Thrones I', 1, NULL, 5, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testQueryBuilder.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testQueryBuilder.sql new file mode 100644 index 00000000..c4516fe8 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testQueryBuilder.sql @@ -0,0 +1,12 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Games of Thrones I', 1, NULL, NULL, 1, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT COUNT(*) AS count FROM (SELECT "books"."id" FROM "books" AS "books" LEFT JOIN "eans" AS "ean" ON ("books"."ean_id" = "ean"."id") WHERE (("ean"."code" = '1234'))) temp; +SELECT "books".* FROM "books" AS "books" LEFT JOIN "eans" AS "ean" ON ("books"."ean_id" = "ean"."id") WHERE (("ean"."code" = '1234')); +SELECT COUNT(*) AS count FROM (SELECT "eans"."id" FROM "eans" AS "eans" LEFT JOIN "books" AS "book" ON ("eans"."id" = "book"."ean_id") WHERE (("book"."title" = 'Games of Thrones I'))) temp; +SELECT "eans".* FROM "eans" AS "eans" LEFT JOIN "books" AS "book" ON ("eans"."id" = "book"."ean_id") WHERE (("book"."title" = 'Games of Thrones I')); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testRemove.sql new file mode 100644 index 00000000..4b7bdc2c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testRemove.sql @@ -0,0 +1,10 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "eans" ("code", "type") VALUES ('1234', 2); +SELECT CURRVAL('eans_id_seq'); +UPDATE "books" SET "ean_id" = 1 WHERE "id" = 1; +COMMIT; +START TRANSACTION; +UPDATE "books" SET "ean_id" = NULL WHERE "id" = 1; +DELETE FROM "eans" WHERE "id" = 1; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationship.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationship.sql new file mode 100644 index 00000000..4c7e85b1 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationship.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationshipWithNULL.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationshipWithNULL.sql new file mode 100644 index 00000000..4c7e85b1 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipOneHasOneTest_testUpdateRelationshipWithNULL.sql @@ -0,0 +1,2 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindBy.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindBy.sql new file mode 100644 index 00000000..a4258825 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindBy.sql @@ -0,0 +1,14 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1)) AND (("books"."id" = 1))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1)) AND (("books"."id" = 1))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE ((("books"."publisher_id" = 1))) AND ("books"."author_id" IN (1))) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindByRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindByRemove.sql new file mode 100644 index 00000000..09a7187b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testFindByRemove.sql @@ -0,0 +1,6 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 3)); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."id" NOT IN (3)))) AND ("books"."translator_id" IN (2)); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."id" NOT IN (3)))) AND ("books"."translator_id" IN (2)) ORDER BY "books"."id" ASC LIMIT 1; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testGetBy.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testGetBy.sql new file mode 100644 index 00000000..7198cdac --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testGetBy.sql @@ -0,0 +1,3 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testSelect.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testSelect.sql new file mode 100644 index 00000000..36fb5a1c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsHasManyCollectionTest_testSelect.sql @@ -0,0 +1,11 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE "books"."author_id" IN (1)) AS "temp" GROUP BY "author_id"; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "author_id", COUNT(DISTINCT "count") as "count" FROM (SELECT "books".*, "books"."id" AS "count" FROM "books" AS "books" WHERE "books"."author_id" IN (1)) AS "temp" GROUP BY "author_id"; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddA.sql new file mode 100644 index 00000000..b0ff7210 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddA.sql @@ -0,0 +1,8 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddB.sql new file mode 100644 index 00000000..4146fd0d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddB.sql @@ -0,0 +1,10 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddC.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddC.sql new file mode 100644 index 00000000..4146fd0d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddC.sql @@ -0,0 +1,10 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddD.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddD.sql new file mode 100644 index 00000000..80d3e87a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddD.sql @@ -0,0 +1,13 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 5); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4, 5))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddE.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddE.sql new file mode 100644 index 00000000..80d3e87a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddE.sql @@ -0,0 +1,13 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 5); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4, 5))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddF.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddF.sql new file mode 100644 index 00000000..486c3221 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddF.sql @@ -0,0 +1,11 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 5); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4, 5))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddH.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddH.sql new file mode 100644 index 00000000..2182818f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddH.sql @@ -0,0 +1,12 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4), (1, 5); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4, 5))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddI.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddI.sql new file mode 100644 index 00000000..4c2138b9 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testAddI.sql @@ -0,0 +1,15 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #1', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 4); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4))); +INSERT INTO "tags" ("name", "is_global") VALUES ('New Tag #2', 'y'); +SELECT CURRVAL('tags_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (1, 5); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 4, 5))); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionA.sql new file mode 100644 index 00000000..e463474b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionA.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionB.sql new file mode 100644 index 00000000..d34dc8eb --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchDerivedCollectionB.sql @@ -0,0 +1,3 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +(SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" = 1 ORDER BY "tags"."id" ASC LIMIT 1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchExistingA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchExistingA.sql new file mode 100644 index 00000000..1245a8ea --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testFetchExistingA.sql @@ -0,0 +1,10 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2))); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (2); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2))); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (1, 2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1, 2, 3))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveA.sql new file mode 100644 index 00000000..675b4a98 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveA.sql @@ -0,0 +1,13 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 2)); +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."tag_id" IN (2); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (2); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1, 2))); +SELECT "publishers_x_tags"."publisher_id", "publishers_x_tags"."tag_id" FROM "publishers" AS "publishers" LEFT JOIN "publishers_x_tags" AS "publishers_x_tags" ON ("publishers_x_tags"."publisher_id" = "publishers"."publisher_id") WHERE "publishers_x_tags"."tag_id" IN (2); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (2); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((1, 2)); +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((2, 2)); +DELETE FROM "tag_followers" WHERE "author_id" = 2 AND "tag_id" = 2; +DELETE FROM "tags" WHERE "id" = 2; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveB.sql new file mode 100644 index 00000000..085b00c3 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsManyHasManyCollectionTest_testRemoveB.sql @@ -0,0 +1,6 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 3)); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" = 1)); +SELECT "books_x_tags"."book_id", "books_x_tags"."tag_id" FROM "books" AS "books" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."book_id" = "books"."id") WHERE "books_x_tags"."tag_id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" IN (1))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddA.sql new file mode 100644 index 00000000..e9917d05 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddA.sql @@ -0,0 +1,8 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddB.sql new file mode 100644 index 00000000..ac06cfd7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddB.sql @@ -0,0 +1,9 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddC.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddC.sql new file mode 100644 index 00000000..ac06cfd7 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddC.sql @@ -0,0 +1,9 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddD.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddD.sql new file mode 100644 index 00000000..d324fdb6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddD.sql @@ -0,0 +1,11 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #2', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddE.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddE.sql new file mode 100644 index 00000000..d324fdb6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddE.sql @@ -0,0 +1,11 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #2', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddF.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddF.sql new file mode 100644 index 00000000..6bc7b433 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddF.sql @@ -0,0 +1,10 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #2', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddH.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddH.sql new file mode 100644 index 00000000..71ae2c23 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddH.sql @@ -0,0 +1,11 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #2', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddI.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddI.sql new file mode 100644 index 00000000..5bc340c6 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testAddI.sql @@ -0,0 +1,12 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #1', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('New Book #2', 1, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionA.sql new file mode 100644 index 00000000..7f72c4bb --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionA.sql @@ -0,0 +1,4 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionB.sql new file mode 100644 index 00000000..c9805971 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchDerivedCollectionB.sql @@ -0,0 +1,4 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC LIMIT 1; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchExistingA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchExistingA.sql new file mode 100644 index 00000000..143dc719 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testFetchExistingA.sql @@ -0,0 +1,6 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testReAdd.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testReAdd.sql new file mode 100644 index 00000000..7f72c4bb --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testReAdd.sql @@ -0,0 +1,4 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveA.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveA.sql new file mode 100644 index 00000000..d7971bb5 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveA.sql @@ -0,0 +1,10 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books".* FROM "books" AS "books" WHERE ((("books"."id" NOT IN (1)))) AND ("books"."author_id" IN (1)) ORDER BY "books"."id" DESC; +START TRANSACTION; +UPDATE "books" SET "author_id" = 2 WHERE "id" = 1; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveB.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveB.sql new file mode 100644 index 00000000..77397a12 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveB.sql @@ -0,0 +1,12 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (2); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (2); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((2, 2), (2, 3)); +DELETE FROM "books" WHERE "id" = 2; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveC.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveC.sql new file mode 100644 index 00000000..77397a12 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveC.sql @@ -0,0 +1,12 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 2)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (1); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (2, 3))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (2); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (2); +START TRANSACTION; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((2, 2), (2, 3)); +DELETE FROM "books" WHERE "id" = 2; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveD.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveD.sql new file mode 100644 index 00000000..17427fbd --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyCollectionTest_testRemoveD.sql @@ -0,0 +1,5 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."translator_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testCollectionState.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testCollectionState.sql new file mode 100644 index 00000000..e996168b --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testCollectionState.sql @@ -0,0 +1,12 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Arnold Judas Rimmer', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +START TRANSACTION; +INSERT INTO "publishers" ("name") VALUES ('Jupiter Mining Corporation'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Better Than Life', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testForeignKeyInNonConnectedRelationship.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testForeignKeyInNonConnectedRelationship.sql new file mode 100644 index 00000000..a81bddd9 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testForeignKeyInNonConnectedRelationship.sql @@ -0,0 +1,16 @@ +START TRANSACTION; +INSERT INTO "users" ("id") VALUES (1); +INSERT INTO "user_stats" ("user_id", "date", "value") VALUES (1, '2021-12-14 21:03:00.000000'::timestamptz, 3); +INSERT INTO "users" ("id") VALUES (2); +INSERT INTO "users_x_users" ("my_friends_id", "friends_with_me_id") VALUES (2, 1); +COMMIT; +SELECT "users_x_users"."friends_with_me_id", "users_x_users"."my_friends_id" FROM "users" AS "users" LEFT JOIN "users_x_users" AS "users_x_users" ON ("users_x_users"."friends_with_me_id" = "users"."id") WHERE "users_x_users"."my_friends_id" IN (1); +SELECT "users_x_users"."my_friends_id", "users_x_users"."friends_with_me_id" FROM "users" AS "users" LEFT JOIN "users_x_users" AS "users_x_users" ON ("users_x_users"."my_friends_id" = "users"."id") WHERE "users_x_users"."friends_with_me_id" IN (1); +SELECT "users".* FROM "users" AS "users" WHERE (("users"."id" IN (2))); +START TRANSACTION; +DELETE FROM "users_x_users" WHERE ("my_friends_id", "friends_with_me_id") IN ((2, 1)); +ROLLBACK; +SELECT "users".* FROM "users" AS "users" WHERE (("users"."id" IN (1, 2))); +SELECT "user_stats".* FROM "user_stats" AS "user_stats" WHERE ((("user_stats"."user_id", "user_stats"."date") IN ((1, '2021-12-14 21:03:00.000000'::timestamptz)))); +SELECT "users_x_users"."my_friends_id", "users_x_users"."friends_with_me_id" FROM "users" AS "users" LEFT JOIN "users_x_users" AS "users_x_users" ON ("users_x_users"."my_friends_id" = "users"."id") WHERE "users_x_users"."friends_with_me_id" IN (1, 2); +SELECT "users".* FROM "users" AS "users" WHERE (("users"."id" IN (2))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testPersisting.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testPersisting.sql new file mode 100644 index 00000000..1bab3a4f --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testPersisting.sql @@ -0,0 +1,21 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Persistence Author', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book XX', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Persistence Author 2', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book YY', 4, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "authors".* FROM "public"."authors" AS "authors"; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (1, 2, 3, 4) ORDER BY "books"."id" DESC; +START TRANSACTION; +UPDATE "books" SET "title" = 'Book 2#' WHERE "id" = 2; +UPDATE "books" SET "title" = 'Book 1#' WHERE "id" = 1; +UPDATE "books" SET "title" = 'Book 4#' WHERE "id" = 4; +UPDATE "books" SET "title" = 'Book 3#' WHERE "id" = 3; +UPDATE "books" SET "title" = 'Book XX#' WHERE "id" = 5; +UPDATE "books" SET "title" = 'Book YY#' WHERE "id" = 6; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testRepeatedPersisting.sql b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testRepeatedPersisting.sql new file mode 100644 index 00000000..be4cb121 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Relationships/RelationshipsOneHasManyPersistenceTest_testRepeatedPersisting.sql @@ -0,0 +1,11 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Arnold Judas Rimmer', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Jupiter Mining Corporation'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Better Than Life', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +START TRANSACTION; +UPDATE "books" SET "title" = 'Backwards' WHERE "id" = 5; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnBeforePersist.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnBeforePersist.sql new file mode 100644 index 00000000..dbd682bd --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnBeforePersist.sql @@ -0,0 +1,9 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Test', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Pub'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Test Book', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnFlush.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnFlush.sql new file mode 100644 index 00000000..8254a3aa --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCallbacksTest_testOnFlush.sql @@ -0,0 +1,10 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Test', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "publishers" ("name") VALUES ('Pub'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testBasicCascadeRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testBasicCascadeRemove.sql new file mode 100644 index 00000000..b3ad2ae1 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testBasicCascadeRemove.sql @@ -0,0 +1,28 @@ +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 2)); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE (("authors"."id" = 1)); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5', 1, 2, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 3)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (2) ORDER BY "books"."id" DESC; +SELECT "tag_followers".* FROM "tag_followers" AS "tag_followers" WHERE "tag_followers"."author_id" IN (2); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."favorite_author_id" IN (2); +SELECT "books".* FROM "books" AS "books" WHERE "books"."translator_id" IN (2); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (4, 3); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (3))); +SELECT "books".* FROM "books" AS "books" WHERE "books"."id" IN (3); +SELECT "books".* FROM "books" AS "books" WHERE "books"."next_part" IN (4, 3); +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE "publishers"."publisher_id" IN (1, 3); +SELECT "authors".* FROM "public"."authors" AS "authors" WHERE "authors"."id" IN (2); +SELECT "tags".* FROM "tags" AS "tags" WHERE "tags"."id" IN (2); +START TRANSACTION; +UPDATE "books" SET "translator_id" = NULL WHERE "id" = 5; +DELETE FROM "books_x_tags" WHERE ("book_id", "tag_id") IN ((3, 3)); +DELETE FROM "books" WHERE "id" = 4; +DELETE FROM "books" WHERE "id" = 3; +DELETE FROM "tag_followers" WHERE "author_id" = 2 AND "tag_id" = 2; +DELETE FROM "public"."authors" WHERE "id" = 2; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testForeignKeyConstraintRemove.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testForeignKeyConstraintRemove.sql new file mode 100644 index 00000000..e1987a8a --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testForeignKeyConstraintRemove.sql @@ -0,0 +1,2 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE "books"."publisher_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testSti.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testSti.sql new file mode 100644 index 00000000..3e331571 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryCascadeRemoveTest_testSti.sql @@ -0,0 +1,9 @@ +SELECT "contents".* FROM "contents" AS "contents" WHERE (("contents"."id" = 2)); +SELECT "contents".* FROM "contents" AS "contents" WHERE "contents"."id" IN (1); +SELECT "contents".* FROM "contents" AS "contents" WHERE "contents"."thread_id" IN (1); +SELECT "contents".* FROM "contents" AS "contents" WHERE "contents"."id" IN (1); +START TRANSACTION; +DELETE FROM "contents" WHERE "id" = 2; +DELETE FROM "contents" WHERE "id" = 3; +DELETE FROM "contents" WHERE "id" = 1; +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryIdentityMapTest_testPersistence.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryIdentityMapTest_testPersistence.sql new file mode 100644 index 00000000..bcee933e --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryIdentityMapTest_testPersistence.sql @@ -0,0 +1,8 @@ +SELECT "publishers".* FROM "publishers" AS "publishers" WHERE (("publishers"."publisher_id" = 1)); +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('B', 3, NULL, NULL, NULL, 1, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; +SELECT "books".* FROM "books" AS "books" WHERE "books"."author_id" IN (3) ORDER BY "books"."id" DESC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryMagicMethodsTest_testDefinedProxyMethods.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryMagicMethodsTest_testDefinedProxyMethods.sql new file mode 100644 index 00000000..2be04c3d --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryMagicMethodsTest_testDefinedProxyMethods.sql @@ -0,0 +1 @@ +SELECT "books".* FROM "books" AS "books" WHERE id % 2 = 0; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testComplexPersistenceTree.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testComplexPersistenceTree.sql new file mode 100644 index 00000000..9048cc88 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testComplexPersistenceTree.sql @@ -0,0 +1,882 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 0', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 0'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-0', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 1'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-1', 3, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 2'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-2', 3, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 3'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-3', 3, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 4'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-4', 3, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 5'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-5', 3, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 6'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-6', 3, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 7'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-7', 3, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 8'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-8', 3, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 9'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-9', 3, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 10'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-10', 3, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 11'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-11', 3, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 12'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-12', 3, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 13'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-13', 3, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 14'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-14', 3, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 15'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-15', 3, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 16'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-16', 3, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 17'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-17', 3, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 18'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-18', 3, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Publisher 19'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 0-19', 3, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 1', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-0', 4, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 2', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-0', 5, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 3', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-0', 6, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 4', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-0', 7, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 5', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-0', 8, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 6', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-0', 9, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 7', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-0', 10, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 8', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-0', 11, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 9', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-0', 12, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 10', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-0', 13, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 11', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-0', 14, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 12', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-0', 15, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 13', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-0', 16, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 14', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-0', 17, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 15', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-0', 18, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 16', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-0', 19, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 17', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-0', 20, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 18', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-0', 21, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author 19', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-0', 22, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-1', 4, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-1', 5, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-1', 6, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-1', 7, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-1', 8, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-1', 9, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-1', 10, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-1', 11, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-1', 12, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-1', 13, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-1', 14, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-1', 15, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-1', 16, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-1', 17, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-1', 18, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-1', 19, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-1', 20, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-1', 21, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-1', 22, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-2', 4, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-2', 5, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-2', 6, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-2', 7, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-2', 8, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-2', 9, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-2', 10, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-2', 11, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-2', 12, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-2', 13, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-2', 14, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-2', 15, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-2', 16, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-2', 17, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-2', 18, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-2', 19, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-2', 20, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-2', 21, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-2', 22, NULL, NULL, NULL, 6, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-3', 4, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-3', 5, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-3', 6, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-3', 7, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-3', 8, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-3', 9, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-3', 10, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-3', 11, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-3', 12, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-3', 13, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-3', 14, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-3', 15, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-3', 16, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-3', 17, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-3', 18, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-3', 19, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-3', 20, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-3', 21, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-3', 22, NULL, NULL, NULL, 7, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-4', 4, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-4', 5, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-4', 6, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-4', 7, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-4', 8, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-4', 9, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-4', 10, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-4', 11, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-4', 12, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-4', 13, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-4', 14, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-4', 15, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-4', 16, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-4', 17, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-4', 18, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-4', 19, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-4', 20, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-4', 21, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-4', 22, NULL, NULL, NULL, 8, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-5', 4, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-5', 5, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-5', 6, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-5', 7, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-5', 8, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-5', 9, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-5', 10, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-5', 11, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-5', 12, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-5', 13, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-5', 14, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-5', 15, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-5', 16, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-5', 17, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-5', 18, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-5', 19, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-5', 20, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-5', 21, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-5', 22, NULL, NULL, NULL, 9, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-6', 4, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-6', 5, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-6', 6, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-6', 7, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-6', 8, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-6', 9, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-6', 10, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-6', 11, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-6', 12, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-6', 13, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-6', 14, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-6', 15, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-6', 16, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-6', 17, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-6', 18, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-6', 19, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-6', 20, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-6', 21, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-6', 22, NULL, NULL, NULL, 10, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-7', 4, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-7', 5, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-7', 6, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-7', 7, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-7', 8, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-7', 9, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-7', 10, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-7', 11, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-7', 12, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-7', 13, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-7', 14, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-7', 15, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-7', 16, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-7', 17, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-7', 18, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-7', 19, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-7', 20, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-7', 21, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-7', 22, NULL, NULL, NULL, 11, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-8', 4, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-8', 5, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-8', 6, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-8', 7, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-8', 8, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-8', 9, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-8', 10, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-8', 11, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-8', 12, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-8', 13, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-8', 14, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-8', 15, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-8', 16, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-8', 17, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-8', 18, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-8', 19, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-8', 20, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-8', 21, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-8', 22, NULL, NULL, NULL, 12, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-9', 4, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-9', 5, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-9', 6, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-9', 7, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-9', 8, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-9', 9, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-9', 10, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-9', 11, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-9', 12, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-9', 13, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-9', 14, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-9', 15, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-9', 16, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-9', 17, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-9', 18, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-9', 19, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-9', 20, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-9', 21, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-9', 22, NULL, NULL, NULL, 13, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-10', 4, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-10', 5, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-10', 6, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-10', 7, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-10', 8, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-10', 9, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-10', 10, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-10', 11, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-10', 12, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-10', 13, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-10', 14, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-10', 15, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-10', 16, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-10', 17, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-10', 18, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-10', 19, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-10', 20, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-10', 21, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-10', 22, NULL, NULL, NULL, 14, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-11', 4, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-11', 5, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-11', 6, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-11', 7, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-11', 8, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-11', 9, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-11', 10, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-11', 11, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-11', 12, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-11', 13, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-11', 14, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-11', 15, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-11', 16, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-11', 17, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-11', 18, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-11', 19, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-11', 20, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-11', 21, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-11', 22, NULL, NULL, NULL, 15, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-12', 4, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-12', 5, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-12', 6, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-12', 7, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-12', 8, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-12', 9, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-12', 10, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-12', 11, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-12', 12, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-12', 13, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-12', 14, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-12', 15, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-12', 16, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-12', 17, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-12', 18, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-12', 19, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-12', 20, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-12', 21, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-12', 22, NULL, NULL, NULL, 16, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-13', 4, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-13', 5, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-13', 6, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-13', 7, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-13', 8, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-13', 9, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-13', 10, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-13', 11, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-13', 12, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-13', 13, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-13', 14, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-13', 15, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-13', 16, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-13', 17, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-13', 18, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-13', 19, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-13', 20, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-13', 21, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-13', 22, NULL, NULL, NULL, 17, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-14', 4, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-14', 5, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-14', 6, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-14', 7, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-14', 8, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-14', 9, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-14', 10, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-14', 11, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-14', 12, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-14', 13, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-14', 14, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-14', 15, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-14', 16, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-14', 17, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-14', 18, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-14', 19, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-14', 20, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-14', 21, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-14', 22, NULL, NULL, NULL, 18, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-15', 4, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-15', 5, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-15', 6, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-15', 7, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-15', 8, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-15', 9, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-15', 10, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-15', 11, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-15', 12, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-15', 13, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-15', 14, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-15', 15, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-15', 16, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-15', 17, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-15', 18, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-15', 19, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-15', 20, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-15', 21, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-15', 22, NULL, NULL, NULL, 19, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-16', 4, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-16', 5, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-16', 6, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-16', 7, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-16', 8, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-16', 9, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-16', 10, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-16', 11, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-16', 12, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-16', 13, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-16', 14, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-16', 15, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-16', 16, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-16', 17, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-16', 18, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-16', 19, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-16', 20, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-16', 21, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-16', 22, NULL, NULL, NULL, 20, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-17', 4, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-17', 5, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-17', 6, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-17', 7, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-17', 8, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-17', 9, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-17', 10, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-17', 11, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-17', 12, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-17', 13, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-17', 14, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-17', 15, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-17', 16, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-17', 17, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-17', 18, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-17', 19, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-17', 20, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-17', 21, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-17', 22, NULL, NULL, NULL, 21, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-18', 4, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-18', 5, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-18', 6, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-18', 7, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-18', 8, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-18', 9, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-18', 10, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-18', 11, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-18', 12, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-18', 13, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-18', 14, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-18', 15, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-18', 16, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-18', 17, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-18', 18, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-18', 19, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-18', 20, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-18', 21, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-18', 22, NULL, NULL, NULL, 22, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 1-19', 4, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 2-19', 5, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 3-19', 6, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 4-19', 7, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 5-19', 8, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 6-19', 9, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 7-19', 10, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 8-19', 11, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 9-19', 12, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 10-19', 13, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 11-19', 14, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 12-19', 15, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 13-19', 16, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 14-19', 17, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 15-19', 18, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 16-19', 19, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 17-19', 20, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 18-19', 21, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Book 19-19', 22, NULL, NULL, NULL, 23, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testManyHasMany.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testManyHasMany.sql new file mode 100644 index 00000000..72bf0dab --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testManyHasMany.sql @@ -0,0 +1,58 @@ +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('0', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('1', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('2', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('3', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('4', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('5', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('6', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('7', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('8', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +START TRANSACTION; +INSERT INTO "tags" ("name", "is_global") VALUES ('9', 'y'); +SELECT CURRVAL('tags_id_seq'); +COMMIT; +SELECT "tags".* FROM "tags" AS "tags"; +START TRANSACTION; +INSERT INTO "publishers" ("name") VALUES ('Nextras Publisher'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "publishers_x_tags" ("publisher_id", "tag_id") VALUES (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (4, 9), (4, 10), (4, 11), (4, 12), (4, 13); +COMMIT; +SELECT "tags".* FROM "tags" AS "tags" ORDER BY "tags"."id" ASC; +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('A2', '2021-03-21 08:23:00.000000'::timestamp, 'http://www.example.com', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('P2'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('Some Book Title', 3, NULL, NULL, NULL, 5, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books_x_tags" ("book_id", "tag_id") VALUES (5, 1); +COMMIT; +SELECT "books_x_tags"."tag_id", "books_x_tags"."book_id" FROM "tags" AS "tags" LEFT JOIN "books_x_tags" AS "books_x_tags" ON ("books_x_tags"."tag_id" = "tags"."id") WHERE "books_x_tags"."book_id" IN (5); +SELECT "tags".* FROM "tags" AS "tags" WHERE (("tags"."id" IN (1))); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testOneHasOneDirected.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testOneHasOneDirected.sql new file mode 100644 index 00000000..4eeb3be8 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testOneHasOneDirected.sql @@ -0,0 +1,10 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('The Imp', '2000-01-01 12:12:12.000000'::timestamp, 'localhost', NULL); +SELECT CURRVAL('authors_id_seq'); +INSERT INTO "publishers" ("name") VALUES ('Valyria'); +SELECT CURRVAL('publishers_publisher_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall II', 3, NULL, NULL, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +INSERT INTO "books" ("title", "author_id", "translator_id", "next_part", "ean_id", "publisher_id", "published_at", "printed_at", "price", "price_currency", "orig_price_cents", "orig_price_currency") VALUES ('The Wall', 3, 3, 5, NULL, 4, '2021-12-31 23:59:59.000000'::timestamp, NULL, NULL, NULL, NULL, NULL); +SELECT CURRVAL('books_id_seq'); +COMMIT; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testUnsettedNotNullProperty.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testUnsettedNotNullProperty.sql new file mode 100644 index 00000000..dbc0114c --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryPersistenceTest_testUnsettedNotNullProperty.sql @@ -0,0 +1,3 @@ +START TRANSACTION; +INSERT INTO "public"."authors" ("name", "born", "web", "favorite_author_id") VALUES ('Author', '2021-03-21 08:23:00.000000'::timestamp, 'localhost', NULL); +SELECT CURRVAL('authors_id_seq'); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testFindByFiltering.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testFindByFiltering.sql new file mode 100644 index 00000000..5ce184c2 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testFindByFiltering.sql @@ -0,0 +1,2 @@ +SELECT "contents".* FROM "contents" AS "contents" WHERE (("contents"."type" = 'comment') AND ("contents"."replied_at" > '2020-01-01 17:00:00.000000'::timestamptz)); +SELECT COUNT(*) AS count FROM (SELECT "contents"."id" FROM "contents" AS "contents" WHERE (("contents"."type" = 'comment') AND ("contents"."replied_at" > '2020-01-01 17:00:00.000000'::timestamptz))) temp; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testRead.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testRead.sql new file mode 100644 index 00000000..17c6face --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testRead.sql @@ -0,0 +1 @@ +SELECT "contents".* FROM "contents" AS "contents" ORDER BY "contents"."id" ASC; diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testSelect.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testSelect.sql new file mode 100644 index 00000000..38ef14e4 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositorySTITest_testSelect.sql @@ -0,0 +1,2 @@ +SELECT "contents".* FROM "contents" AS "contents" WHERE (("contents"."id" = 1)); +SELECT "contents".* FROM "contents" AS "contents" WHERE "contents"."thread_id" IN (1); diff --git a/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryTest_testNonNullable.sql b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryTest_testNonNullable.sql new file mode 100644 index 00000000..90db2b13 --- /dev/null +++ b/tests/sqls/NextrasTests/Orm/Integration/Repository/RepositoryTest_testNonNullable.sql @@ -0,0 +1,4 @@ +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 923)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 923)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1)); +SELECT "books".* FROM "books" AS "books" WHERE (("books"."id" = 1));