From 18fb777b89c6cca529979ab1202eb1af5458bd5d Mon Sep 17 00:00:00 2001 From: adev Date: Fri, 3 Nov 2017 00:41:47 +0100 Subject: [PATCH 1/7] Add an initial migration --- .travis.yml | 4 - Makefile | 13 +- .../Version20160401000000.php | 181 ++++++++++++++++++ 3 files changed, 182 insertions(+), 16 deletions(-) create mode 100644 app/DoctrineMigrations/Version20160401000000.php diff --git a/.travis.yml b/.travis.yml index 42fbb9661..0d716351a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,10 +72,6 @@ script: - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist - make prepare DB=$DB - - echo "travis_fold:start:migrations" - - php bin/console doctrine:migrations:migrate --no-interaction --env=test - - echo "travis_fold:end:migrations" - - echo "travis_fold:start:fixtures" - php bin/console doctrine:fixtures:load --no-interaction --env=test - echo "travis_fold:end:fixtures" diff --git a/Makefile b/Makefile index 9e44edc6a..0686454fc 100755 --- a/Makefile +++ b/Makefile @@ -30,18 +30,7 @@ ifdef DB endif -php bin/console doctrine:database:drop --force --env=test php bin/console doctrine:database:create --env=test -ifndef DB ## make test does not define DB - php bin/console doctrine:schema:create --env=test -endif -ifeq ($(DB), sqlite) - php bin/console doctrine:schema:create --env=test -endif -ifeq ($(DB), mysql) - php bin/console doctrine:database:import data/sql/mysql_base.sql --env=test -endif -ifeq ($(DB), pgsql) - psql -h localhost -d wallabag_test -U travis -f data/sql/pgsql_base.sql -endif + php bin/console doctrine:migrations:migrate --no-interaction --env=test fixtures: ## Load fixtures into database php bin/console doctrine:fixtures:load --no-interaction --env=test diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php new file mode 100644 index 000000000..34d97d16a --- /dev/null +++ b/app/DoctrineMigrations/Version20160401000000.php @@ -0,0 +1,181 @@ +version->getConfiguration()->getNumberOfExecutedMigrations() > 0) { + $this->version->markMigrated(); + $this->skipIf(true, 'Database already initialized'); + } + + switch ($this->connection->getDatabasePlatform()->getName()) { + case 'sqlite': + $sql = <<addSql($query); + } + + break; + case 'mysql': + $sql = <<addSql($query); + } + break; + + case 'postgresql': + $sql = <<addSql($query); + } + break; + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + //TODO: drop tables + } +} From 2054740fdbae49a3900d84e0b4d2a604c5b099a5 Mon Sep 17 00:00:00 2001 From: adev Date: Sat, 4 Nov 2017 21:14:11 +0100 Subject: [PATCH 2/7] Fold travis make prepare --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0d716351a..26707094e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,7 +70,9 @@ before_install: script: - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist + - echo "travis_fold:start:prepare" - make prepare DB=$DB + - echo "travis_fold:start:prepare" - echo "travis_fold:start:fixtures" - php bin/console doctrine:fixtures:load --no-interaction --env=test From 2680b0bc8c9044b19b80a596f0005a1051b4ee54 Mon Sep 17 00:00:00 2001 From: adev Date: Sat, 4 Nov 2017 21:23:18 +0100 Subject: [PATCH 3/7] Fix installation command --- .../Version20160812120952.php | 28 +++++++++++++++-- .../Version20170824113337.php | 7 ++++- .../CoreBundle/Command/InstallCommand.php | 31 ++++++------------- .../CoreBundle/Command/InstallCommandTest.php | 8 ++--- 4 files changed, 43 insertions(+), 31 deletions(-) diff --git a/app/DoctrineMigrations/Version20160812120952.php b/app/DoctrineMigrations/Version20160812120952.php index 677f30c32..d28f3a71d 100644 --- a/app/DoctrineMigrations/Version20160812120952.php +++ b/app/DoctrineMigrations/Version20160812120952.php @@ -30,7 +30,20 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); $this->skipIf($clientsTable->hasColumn('name'), 'It seems that you already played this migration.'); - $clientsTable->addColumn('name', 'blob'); + if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) { + // Can't use $clientsTable->addColumn('name', 'blob'); + // because of the error: + // SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL + $databaseTablePrefix = $this->container->getParameter('database_table_prefix'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM ' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('DROP TABLE ' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('CREATE TABLE ' . $databaseTablePrefix . 'oauth2_clients (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, name CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $databaseTablePrefix . 'user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO ' . $databaseTablePrefix . 'oauth2_clients (id, random_id, redirect_uris, secret, allowed_grant_types) SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM __temp__' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('DROP TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $databaseTablePrefix . 'oauth2_clients (user_id)'); + } else { + $clientsTable->addColumn('name', 'blob'); + } } /** @@ -39,7 +52,18 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI public function down(Schema $schema) { $clientsTable = $schema->getTable($this->getTable('oauth2_clients')); - $clientsTable->dropColumn('name'); + + if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) { + $databaseTablePrefix = $this->container->getParameter('database_table_prefix'); + $this->addSql('DROP INDEX IDX_635D765EA76ED395'); + $this->addSql('CREATE TEMPORARY TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM ' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('DROP TABLE ' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('CREATE TABLE ' . $databaseTablePrefix . 'oauth2_clients (id INTEGER NOT NULL, random_id VARCHAR(255) NOT NULL, secret VARCHAR(255) NOT NULL, redirect_uris CLOB NOT NULL COLLATE BINARY, allowed_grant_types CLOB NOT NULL COLLATE BINARY, PRIMARY KEY(id))'); + $this->addSql('INSERT INTO ' . $databaseTablePrefix . 'oauth2_clients (id, random_id, redirect_uris, secret, allowed_grant_types) SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM __temp__' . $databaseTablePrefix . 'oauth2_clients'); + $this->addSql('DROP TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients'); + } else { + $clientsTable->dropColumn('name'); + } } private function getTable($tableName) diff --git a/app/DoctrineMigrations/Version20170824113337.php b/app/DoctrineMigrations/Version20170824113337.php index 7393d683d..e54a9bcf7 100644 --- a/app/DoctrineMigrations/Version20170824113337.php +++ b/app/DoctrineMigrations/Version20170824113337.php @@ -41,7 +41,12 @@ class Version20170824113337 extends AbstractMigration implements ContainerAwareI $entryTable = $schema->getTable($this->getTable('entry')); $this->skipIf(!$entryTable->hasColumn('starred_at'), 'Unable to add starred_at colum'); - $this->connection->executeQuery('UPDATE ' . $this->getTable('entry') . ' SET starred_at = updated_at WHERE is_starred = true'); + $this->connection->executeQuery( + 'UPDATE ' . $this->getTable('entry') . ' SET starred_at = updated_at WHERE is_starred = :is_starred', + [ + 'is_starred' => true, + ] + ); } /** diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 877dbfa27..dec2bf9c1 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -61,7 +61,6 @@ class InstallCommand extends ContainerAwareCommand ->setupDatabase() ->setupAdmin() ->setupConfig() - ->runMigrations() ; $this->io->success('Wallabag has been successfully installed.'); @@ -70,7 +69,7 @@ class InstallCommand extends ContainerAwareCommand protected function checkRequirements() { - $this->io->section('Step 1 of 5: Checking system requirements.'); + $this->io->section('Step 1 of 4: Checking system requirements.'); $doctrineManager = $this->getContainer()->get('doctrine')->getManager(); @@ -169,7 +168,7 @@ class InstallCommand extends ContainerAwareCommand protected function setupDatabase() { - $this->io->section('Step 2 of 5: Setting up database.'); + $this->io->section('Step 2 of 4: Setting up database.'); // user want to reset everything? Don't care about what is already here if (true === $this->defaultInput->getOption('reset')) { @@ -178,7 +177,7 @@ class InstallCommand extends ContainerAwareCommand $this ->runCommand('doctrine:database:drop', ['--force' => true]) ->runCommand('doctrine:database:create') - ->runCommand('doctrine:schema:create') + ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]) ->runCommand('cache:clear') ; @@ -192,7 +191,7 @@ class InstallCommand extends ContainerAwareCommand $this ->runCommand('doctrine:database:create') - ->runCommand('doctrine:schema:create') + ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]) ->runCommand('cache:clear') ; @@ -207,7 +206,7 @@ class InstallCommand extends ContainerAwareCommand $this ->runCommand('doctrine:database:drop', ['--force' => true]) ->runCommand('doctrine:database:create') - ->runCommand('doctrine:schema:create') + ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]) ; } elseif ($this->isSchemaPresent()) { if ($this->io->confirm('Seems like your database contains schema. Do you want to reset it?', false)) { @@ -215,14 +214,14 @@ class InstallCommand extends ContainerAwareCommand $this ->runCommand('doctrine:schema:drop', ['--force' => true]) - ->runCommand('doctrine:schema:create') + ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]) ; } } else { $this->io->text('Creating schema...'); $this - ->runCommand('doctrine:schema:create') + ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]) ; } @@ -237,7 +236,7 @@ class InstallCommand extends ContainerAwareCommand protected function setupAdmin() { - $this->io->section('Step 3 of 5: Administration setup.'); + $this->io->section('Step 3 of 4: Administration setup.'); if (!$this->io->confirm('Would you like to create a new admin user (recommended)?', true)) { return $this; @@ -272,7 +271,7 @@ class InstallCommand extends ContainerAwareCommand protected function setupConfig() { - $this->io->section('Step 4 of 5: Config setup.'); + $this->io->section('Step 4 of 4: Config setup.'); $em = $this->getContainer()->get('doctrine.orm.entity_manager'); // cleanup before insert new stuff @@ -293,18 +292,6 @@ class InstallCommand extends ContainerAwareCommand return $this; } - protected function runMigrations() - { - $this->io->section('Step 5 of 5: Run migrations.'); - - $this - ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]); - - $this->io->text('Migrations successfully executed.'); - - return $this; - } - /** * Run a command. * diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index f684a2069..bd351b187 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Command; use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver; use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand; +use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand; use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Symfony\Bundle\FrameworkBundle\Console\Application; @@ -98,7 +99,6 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); } public function testRunInstallCommandWithReset() @@ -125,7 +125,6 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); // we force to reset everything $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay()); @@ -171,7 +170,6 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); // the current database doesn't already exist $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay()); @@ -198,7 +196,6 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); $this->assertContains('Dropping schema and creating schema', $tester->getDisplay()); } @@ -209,6 +206,7 @@ class InstallCommandTest extends WallabagCoreTestCase $application->add(new InstallCommand()); $application->add(new DropDatabaseDoctrineCommand()); $application->add(new CreateDatabaseDoctrineCommand()); + $application->add(new MigrationsMigrateDoctrineCommand()); // drop database first, so the install command won't ask to reset things $command = new DropDatabaseDoctrineCommand(); @@ -242,7 +240,6 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); $this->assertContains('Creating schema', $tester->getDisplay()); } @@ -265,6 +262,5 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Administration setup.', $tester->getDisplay()); $this->assertContains('Config setup.', $tester->getDisplay()); - $this->assertContains('Run migrations.', $tester->getDisplay()); } } From 18865cec8621d697e9b174ab4b9203517be5dfcc Mon Sep 17 00:00:00 2001 From: adev Date: Sun, 5 Nov 2017 13:32:22 +0100 Subject: [PATCH 4/7] Implements down migration --- app/DoctrineMigrations/Version20160401000000.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php index 34d97d16a..af1350069 100644 --- a/app/DoctrineMigrations/Version20160401000000.php +++ b/app/DoctrineMigrations/Version20160401000000.php @@ -176,6 +176,17 @@ SQL */ public function down(Schema $schema) { - //TODO: drop tables + $this->addSql('DROP TABLE wallabag_craue_config_setting'); + $this->addSql('DROP TABLE "wallabag_tagging_rule"'); + $this->addSql('DROP TABLE "wallabag_config"'); + $this->addSql('DROP TABLE "wallabag_entry"'); + $this->addSql('DROP TABLE wallabag_entry_tag'); + $this->addSql('DROP TABLE "wallabag_tag"'); + $this->addSql('DROP TABLE wallabag_oauth2_refresh_tokens'); + $this->addSql('DROP TABLE wallabag_oauth2_access_tokens'); + $this->addSql('DROP TABLE wallabag_oauth2_clients'); + $this->addSql('DROP TABLE wallabag_oauth2_auth_codes'); + $this->addSql('DROP TABLE "wallabag_user"'); + $this->addSql('DROP TABLE wallabag_annotation'); } } From 4c0ac1d10b68aa7a08bf554a798c82bc06423905 Mon Sep 17 00:00:00 2001 From: adev Date: Sun, 5 Nov 2017 13:54:16 +0100 Subject: [PATCH 5/7] Remove data sql files --- data/sql/mysql_base.sql | 25 ---------------- data/sql/pgsql_base.sql | 62 ---------------------------------------- data/sql/sqlite_base.sql | 33 --------------------- 3 files changed, 120 deletions(-) delete mode 100644 data/sql/mysql_base.sql delete mode 100644 data/sql/pgsql_base.sql delete mode 100644 data/sql/sqlite_base.sql diff --git a/data/sql/mysql_base.sql b/data/sql/mysql_base.sql deleted file mode 100644 index 13fa63028..000000000 --- a/data/sql/mysql_base.sql +++ /dev/null @@ -1,25 +0,0 @@ -CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE `wallabag_entry` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, is_archived TINYINT(1) NOT NULL, is_starred TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype LONGTEXT DEFAULT NULL, language LONGTEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name LONGTEXT DEFAULT NULL, preview_picture LONGTEXT DEFAULT NULL, is_public TINYINT(1) DEFAULT '0', INDEX IDX_F4D18282A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_C9F0DD7CBA364942 (entry_id), INDEX IDX_C9F0DD7CBAD26311 (tag_id), PRIMARY KEY(entry_id, tag_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE `wallabag_config` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, UNIQUE INDEX UNIQ_87E64C53A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE `wallabag_tagging_rule` (id INT AUTO_INCREMENT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags LONGTEXT NOT NULL COMMENT '(DC2Type:simple_array)', INDEX IDX_2D9B3C5424DB0683 (config_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE `wallabag_tag` (id INT AUTO_INCREMENT NOT NULL, `label` LONGTEXT NOT NULL, slug VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_4CA58A8C989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_oauth2_clients (id INT AUTO_INCREMENT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris LONGTEXT NOT NULL COMMENT '(DC2Type:array)', secret VARCHAR(255) NOT NULL, allowed_grant_types LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_oauth2_access_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_368A42095F37A13B (token), INDEX IDX_368A420919EB6921 (client_id), INDEX IDX_368A4209A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_oauth2_refresh_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_20C9FB245F37A13B (token), INDEX IDX_20C9FB2419EB6921 (client_id), INDEX IDX_20C9FB24A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_oauth2_auth_codes (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri LONGTEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_EE52E3FA5F37A13B (token), INDEX IDX_EE52E3FA19EB6921 (client_id), INDEX IDX_EE52E3FAA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE `wallabag_user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', credentials_expired TINYINT(1) NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication TINYINT(1) NOT NULL, trusted LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json_array)', UNIQUE INDEX UNIQ_1D63E7E592FC23A8 (username_canonical), UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF (email_canonical), UNIQUE INDEX UNIQ_1D63E7E5C05FB297 (confirmation_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -CREATE TABLE wallabag_annotation (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges LONGTEXT NOT NULL COMMENT '(DC2Type:array)', INDEX IDX_A7AED006A76ED395 (user_id), INDEX IDX_A7AED006BA364942 (entry_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; -ALTER TABLE `wallabag_entry` ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id); -ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES `wallabag_tag` (id); -ALTER TABLE `wallabag_config` ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE `wallabag_tagging_rule` ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES `wallabag_config` (id); -ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id); -ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id); -ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id); -ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id); -ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id); diff --git a/data/sql/pgsql_base.sql b/data/sql/pgsql_base.sql deleted file mode 100644 index 6688fe835..000000000 --- a/data/sql/pgsql_base.sql +++ /dev/null @@ -1,62 +0,0 @@ -CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name)); -CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name); -CREATE TABLE "wallabag_entry" (id INT NOT NULL, user_id INT DEFAULT NULL, title TEXT DEFAULT NULL, url TEXT DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, mimetype TEXT DEFAULT NULL, language TEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name TEXT DEFAULT NULL, preview_picture TEXT DEFAULT NULL, is_public BOOLEAN DEFAULT 'false', PRIMARY KEY(id)); -CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id); -CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(entry_id, tag_id)); -CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id); -CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id); -CREATE TABLE "wallabag_config" (id INT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id); -CREATE TABLE "wallabag_tagging_rule" (id INT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags TEXT NOT NULL, PRIMARY KEY(id)); -CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id); -COMMENT ON COLUMN "wallabag_tagging_rule".tags IS '(DC2Type:simple_array)'; -CREATE TABLE "wallabag_tag" (id INT NOT NULL, label TEXT NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug); -CREATE TABLE wallabag_oauth2_clients (id INT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris TEXT NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types TEXT NOT NULL, PRIMARY KEY(id)); -COMMENT ON COLUMN wallabag_oauth2_clients.redirect_uris IS '(DC2Type:array)'; -COMMENT ON COLUMN wallabag_oauth2_clients.allowed_grant_types IS '(DC2Type:array)'; -CREATE TABLE wallabag_oauth2_access_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token); -CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id); -CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id); -CREATE TABLE wallabag_oauth2_refresh_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token); -CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id); -CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id); -CREATE TABLE wallabag_oauth2_auth_codes (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri TEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token); -CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id); -CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id); -CREATE TABLE "wallabag_user" (id INT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, roles TEXT NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, name TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted TEXT DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical); -CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical); -CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token); -COMMENT ON COLUMN "wallabag_user".roles IS '(DC2Type:array)'; -COMMENT ON COLUMN "wallabag_user".trusted IS '(DC2Type:json_array)'; -CREATE TABLE wallabag_annotation (id INT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text TEXT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, quote VARCHAR(255) NOT NULL, ranges TEXT NOT NULL, PRIMARY KEY(id)); -CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id); -CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id); -COMMENT ON COLUMN wallabag_annotation.ranges IS '(DC2Type:array)'; -CREATE SEQUENCE "entry_id_seq" INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE "config_id_seq" INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE "tagging_rule_id_seq" INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE "tag_id_seq" INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE oauth2_clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE oauth2_access_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE oauth2_refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE oauth2_auth_codes_id_seq INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1; -CREATE SEQUENCE annotation_id_seq INCREMENT BY 1 MINVALUE 1 START 1; -ALTER TABLE "wallabag_entry" ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE "wallabag_config" ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE "wallabag_tagging_rule" ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; -ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE; diff --git a/data/sql/sqlite_base.sql b/data/sql/sqlite_base.sql deleted file mode 100644 index d2780d96d..000000000 --- a/data/sql/sqlite_base.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name)); -CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name); -CREATE TABLE "wallabag_tagging_rule" (id INTEGER NOT NULL, config_id INTEGER DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id); -CREATE TABLE "wallabag_tag" (id INTEGER NOT NULL, label CLOB NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug); -CREATE TABLE "wallabag_entry" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, is_public BOOLEAN DEFAULT '0', PRIMARY KEY(id), CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id); -CREATE TABLE wallabag_entry_tag (entry_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, PRIMARY KEY(entry_id, tag_id), CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id); -CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id); -CREATE TABLE "wallabag_config" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INTEGER DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id); -CREATE TABLE wallabag_oauth2_refresh_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token); -CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id); -CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id); -CREATE TABLE wallabag_oauth2_access_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token); -CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id); -CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id); -CREATE TABLE wallabag_oauth2_auth_codes (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri CLOB NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token); -CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id); -CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id); -CREATE TABLE wallabag_oauth2_clients (id INTEGER NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris CLOB NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types CLOB NOT NULL, PRIMARY KEY(id)); -CREATE TABLE "wallabag_user" (id INTEGER NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted CLOB DEFAULT NULL, PRIMARY KEY(id)); -CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical); -CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical); -CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token); -CREATE TABLE wallabag_annotation (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, entry_id INTEGER DEFAULT NULL, text CLOB NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE); -CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id); -CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id); From e36c85eb79c6f6ff79caca58e5766df5ac3cbecb Mon Sep 17 00:00:00 2001 From: adev Date: Sun, 5 Nov 2017 14:02:46 +0100 Subject: [PATCH 6/7] Fix travis fold --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26707094e..c6c03dc3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,7 +72,7 @@ script: - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist - echo "travis_fold:start:prepare" - make prepare DB=$DB - - echo "travis_fold:start:prepare" + - echo "travis_fold:end:prepare" - echo "travis_fold:start:fixtures" - php bin/console doctrine:fixtures:load --no-interaction --env=test From f4e7a0df0e5917c51889f95e049eda2f81a8416e Mon Sep 17 00:00:00 2001 From: adev Date: Tue, 21 Nov 2017 22:07:37 +0100 Subject: [PATCH 7/7] Fix phpcs --- app/DoctrineMigrations/Version20160401000000.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php index af1350069..a8603abf6 100644 --- a/app/DoctrineMigrations/Version20160401000000.php +++ b/app/DoctrineMigrations/Version20160401000000.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** - * Initial database structure + * Initial database structure. */ class Version20160401000000 extends AbstractMigration { @@ -22,7 +22,7 @@ class Version20160401000000 extends AbstractMigration switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite': - $sql = <<addSql($query); } break; - case 'postgresql': - $sql = <<