aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-12-23 09:31:41 +0100
committerGitHub <noreply@github.com>2016-12-23 09:31:41 +0100
commit771934632833720c4d0560dc589f22d4f1bdb55e (patch)
treef7811a5f8d918f51030d2aadafe55226370a93e3
parentcd77a7e7eff5d6940a7037387062aa5dde64128c (diff)
parenta72f3dc308f2e4386f73e88af41db919ba0acaf3 (diff)
downloadwallabag-771934632833720c4d0560dc589f22d4f1bdb55e.tar.gz
wallabag-771934632833720c4d0560dc589f22d4f1bdb55e.tar.zst
wallabag-771934632833720c4d0560dc589f22d4f1bdb55e.zip
Merge pull request #2696 from wallabag/run-migration
Run migration on each test
-rw-r--r--app/DoctrineMigrations/Version20160916201049.php2
-rw-r--r--app/DoctrineMigrations/Version20161001072726.php76
-rw-r--r--app/DoctrineMigrations/Version20161022134138.php10
-rw-r--r--app/DoctrineMigrations/Version20161031132655.php4
-rw-r--r--app/DoctrineMigrations/Version20161106113822.php1
-rw-r--r--build.xml110
-rw-r--r--data/sql/mysql_base.sql25
-rw-r--r--data/sql/pgsql_base.sql62
-rw-r--r--data/sql/sqlite_base.sql33
-rw-r--r--src/Wallabag/ApiBundle/Entity/Client.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php2
12 files changed, 299 insertions, 30 deletions
diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
index 9390755e..8b42bb87 100644
--- a/app/DoctrineMigrations/Version20160916201049.php
+++ b/app/DoctrineMigrations/Version20160916201049.php
@@ -33,7 +33,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
33 33
34 $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.'); 34 $this->skipIf($configTable->hasColumn('pocket_consumer_key'), 'It seems that you already played this migration.');
35 35
36 $configTable->addColumn('pocket_consumer_key', 'string'); 36 $configTable->addColumn('pocket_consumer_key', 'string', ['notnull' => false]);
37 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';"); 37 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'pocket_consumer_key';");
38 } 38 }
39 39
diff --git a/app/DoctrineMigrations/Version20161001072726.php b/app/DoctrineMigrations/Version20161001072726.php
index 5ab88555..f6930778 100644
--- a/app/DoctrineMigrations/Version20161001072726.php
+++ b/app/DoctrineMigrations/Version20161001072726.php
@@ -32,22 +32,82 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.'); 32 $this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
33 33
34 // remove all FK from entry_tag 34 // remove all FK from entry_tag
35 $query = $this->connection->query("SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage WHERE TABLE_NAME = '".$this->getTable('entry_tag')."' AND CONSTRAINT_NAME LIKE 'FK_%' AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'"); 35 switch ($this->connection->getDatabasePlatform()->getName()) {
36 $query->execute(); 36 case 'mysql':
37 $query = $this->connection->query("
38 SELECT CONSTRAINT_NAME
39 FROM information_schema.key_column_usage
40 WHERE TABLE_NAME = '".$this->getTable('entry_tag')."' AND CONSTRAINT_NAME LIKE 'FK_%'
41 AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'"
42 );
43 $query->execute();
37 44
38 foreach ($query->fetchAll() as $fk) { 45 foreach ($query->fetchAll() as $fk) {
39 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); 46 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']);
47 }
48 break;
49
50 case 'postgresql':
51 // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
52 $query = $this->connection->query("
53 SELECT conrelid::regclass AS table_from
54 ,conname
55 ,pg_get_constraintdef(c.oid)
56 FROM pg_constraint c
57 JOIN pg_namespace n ON n.oid = c.connamespace
58 WHERE contype = 'f'
59 AND conrelid::regclass::text = '".$this->getTable('entry_tag')."'
60 AND n.nspname = 'public';"
61 );
62 $query->execute();
63
64 foreach ($query->fetchAll() as $fk) {
65 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' DROP CONSTRAINT '.$fk['conname']);
66 }
67 break;
40 } 68 }
41 69
42 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); 70 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE');
43 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_tag FOREIGN KEY (tag_id) REFERENCES '.$this->getTable('tag').' (id) ON DELETE CASCADE'); 71 $this->addSql('ALTER TABLE '.$this->getTable('entry_tag').' ADD CONSTRAINT FK_entry_tag_tag FOREIGN KEY (tag_id) REFERENCES '.$this->getTable('tag').' (id) ON DELETE CASCADE');
44 72
45 // remove entry FK from annotation 73 // remove entry FK from annotation
46 $query = $this->connection->query("SELECT CONSTRAINT_NAME FROM information_schema.key_column_usage WHERE TABLE_NAME = '".$this->getTable('annotation')."' AND CONSTRAINT_NAME LIKE 'FK_%' and COLUMN_NAME = 'entry_id' AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'");
47 $query->execute();
48 74
49 foreach ($query->fetchAll() as $fk) { 75 switch ($this->connection->getDatabasePlatform()->getName()) {
50 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']); 76 case 'mysql':
77 $query = $this->connection->query("
78 SELECT CONSTRAINT_NAME
79 FROM information_schema.key_column_usage
80 WHERE TABLE_NAME = '".$this->getTable('annotation')."'
81 AND CONSTRAINT_NAME LIKE 'FK_%'
82 AND COLUMN_NAME = 'entry_id'
83 AND TABLE_SCHEMA = '".$this->connection->getDatabase()."'"
84 );
85 $query->execute();
86
87 foreach ($query->fetchAll() as $fk) {
88 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP FOREIGN KEY '.$fk['CONSTRAINT_NAME']);
89 }
90 break;
91
92 case 'postgresql':
93 // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
94 $query = $this->connection->query("
95 SELECT conrelid::regclass AS table_from
96 ,conname
97 ,pg_get_constraintdef(c.oid)
98 FROM pg_constraint c
99 JOIN pg_namespace n ON n.oid = c.connamespace
100 WHERE contype = 'f'
101 AND conrelid::regclass::text = '".$this->getTable('annotation')."'
102 AND n.nspname = 'public'
103 AND pg_get_constraintdef(c.oid) LIKE '%entry_id%';"
104 );
105 $query->execute();
106
107 foreach ($query->fetchAll() as $fk) {
108 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' DROP CONSTRAINT '.$fk['conname']);
109 }
110 break;
51 } 111 }
52 112
53 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE'); 113 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES '.$this->getTable('entry').' (id) ON DELETE CASCADE');
diff --git a/app/DoctrineMigrations/Version20161022134138.php b/app/DoctrineMigrations/Version20161022134138.php
index b3d02b40..d0e5cb3f 100644
--- a/app/DoctrineMigrations/Version20161022134138.php
+++ b/app/DoctrineMigrations/Version20161022134138.php
@@ -31,7 +31,13 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI
31 { 31 {
32 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); 32 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
33 33
34 $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;'); 34 $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;');
35
36 // convert field length for utf8mb4
37 // http://stackoverflow.com/a/31474509/569101
38 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE confirmation_token confirmation_token VARCHAR(180) DEFAULT NULL;');
39 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE salt salt VARCHAR(180) NOT NULL;');
40 $this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE password password VARCHAR(180) NOT NULL;');
35 41
36 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); 42 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
37 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); 43 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
@@ -56,7 +62,7 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI
56 { 62 {
57 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL'); 63 $this->skipIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'This migration only apply to MySQL');
58 64
59 $this->addSql('ALTER DATABASE '.$this->container->getParameter('database_name').' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;'); 65 $this->addSql('ALTER DATABASE '.$this->connection->getParams()['dbname'].' CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;');
60 66
61 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); 67 $this->addSql('ALTER TABLE '.$this->getTable('annotation').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
62 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;'); 68 $this->addSql('ALTER TABLE '.$this->getTable('entry').' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
diff --git a/app/DoctrineMigrations/Version20161031132655.php b/app/DoctrineMigrations/Version20161031132655.php
index 770ad2d8..f81898ff 100644
--- a/app/DoctrineMigrations/Version20161031132655.php
+++ b/app/DoctrineMigrations/Version20161031132655.php
@@ -36,7 +36,7 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI
36 36
37 $this->skipIf(false !== $images, 'It seems that you already played this migration.'); 37 $this->skipIf(false !== $images, 'It seems that you already played this migration.');
38 38
39 $this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')"); 39 $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
40 } 40 }
41 41
42 /** 42 /**
@@ -44,6 +44,6 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI
44 */ 44 */
45 public function down(Schema $schema) 45 public function down(Schema $schema)
46 { 46 {
47 $this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'download_images_enabled';"); 47 $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'download_images_enabled';");
48 } 48 }
49} 49}
diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php
index 5032a8f0..55bd87a2 100644
--- a/app/DoctrineMigrations/Version20161106113822.php
+++ b/app/DoctrineMigrations/Version20161106113822.php
@@ -35,6 +35,7 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI
35 35
36 $configTable->addColumn('action_mark_as_read', 'integer', [ 36 $configTable->addColumn('action_mark_as_read', 'integer', [
37 'default' => 0, 37 'default' => 0,
38 'notnull' => false,
38 ]); 39 ]);
39 } 40 }
40 41
diff --git a/build.xml b/build.xml
index 37b40743..b5727e62 100644
--- a/build.xml
+++ b/build.xml
@@ -1,9 +1,9 @@
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<project name="wallabag" default="build"> 2<project name="wallabag" default="build">
3 <target name="build" depends="clean,prepare,phpunit"/> 3 <target name="build" depends="clean,prepare,phpunit"/>
4 <target name="prepare-mysql" depends="clean,db_mysql,prepare"/> 4 <target name="prepare-mysql" depends="clean,prepare_mysql"/>
5 <target name="prepare-sqlite" depends="clean,db_sqlite,prepare"/> 5 <target name="prepare-sqlite" depends="clean,prepare_sqlite"/>
6 <target name="prepare-pgsql" depends="clean,db_pgsql,prepare"/> 6 <target name="prepare-pgsql" depends="clean,prepare_pgsql"/>
7 7
8 <target name="clean" description="Cleanup build artifacts"> 8 <target name="clean" description="Cleanup build artifacts">
9 <delete dir="${basedir}/var/cache"/> 9 <delete dir="${basedir}/var/cache"/>
@@ -28,57 +28,139 @@
28 </exec> 28 </exec>
29 <exec executable="php"> 29 <exec executable="php">
30 <arg value="${basedir}/bin/console"/> 30 <arg value="${basedir}/bin/console"/>
31 <arg value="cache:clear"/>
32 <arg value="--env=test"/>
33 </exec>
34 <exec executable="php">
35 <arg value="${basedir}/bin/console"/>
36 <arg value="doctrine:fixtures:load"/> 31 <arg value="doctrine:fixtures:load"/>
37 <arg value="--no-interaction"/> 32 <arg value="--no-interaction"/>
38 <arg value="--env=test"/> 33 <arg value="--env=test"/>
39 </exec> 34 </exec>
40 </target> 35 </target>
41 36
42 <target name="db_mysql" description="Run test for MySQL"> 37 <target name="prepare_mysql" description="Run test for MySQL">
43 <delete dir="${basedir}/app/config/parameters.yml"/> 38 <delete dir="${basedir}/app/config/parameters.yml"/>
44 <exec executable="cp"> 39 <exec executable="cp">
45 <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/> 40 <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/>
46 <arg value="${basedir}/app/config/parameters_test.yml"/> 41 <arg value="${basedir}/app/config/parameters_test.yml"/>
47 </exec> 42 </exec>
48
49 <exec executable="php"> 43 <exec executable="php">
50 <arg value="${basedir}/bin/console"/> 44 <arg value="${basedir}/bin/console"/>
51 <arg value="cache:clear"/> 45 <arg value="cache:clear"/>
52 <arg value="--env=test"/> 46 <arg value="--env=test"/>
53 </exec> 47 </exec>
48 <exec executable="php">
49 <arg value="${basedir}/bin/console"/>
50 <arg value="doctrine:database:drop"/>
51 <arg value="--force"/>
52 <arg value="--env=test"/>
53 </exec>
54 <exec executable="php">
55 <arg value="${basedir}/bin/console"/>
56 <arg value="doctrine:database:create"/>
57 <arg value="--env=test"/>
58 </exec>
59 <exec executable="php">
60 <arg value="${basedir}/bin/console"/>
61 <arg value="doctrine:database:import"/>
62 <arg value="data/sql/mysql_base.sql"/>
63 <arg value="--env=test"/>
64 </exec>
65 <exec executable="php">
66 <arg value="${basedir}/bin/console"/>
67 <arg value="doctrine:migrations:migrate"/>
68 <arg value="--no-interaction"/>
69 <arg value="--env=test"/>
70 </exec>
71 <exec executable="php">
72 <arg value="${basedir}/bin/console"/>
73 <arg value="doctrine:fixtures:load"/>
74 <arg value="--no-interaction"/>
75 <arg value="--env=test"/>
76 </exec>
54 </target> 77 </target>
55 78
56 <target name="db_sqlite" description="Run test for SQLite"> 79 <target name="prepare_sqlite" description="Run test for SQLite">
57 <delete dir="${basedir}/app/config/parameters.yml"/> 80 <delete dir="${basedir}/app/config/parameters.yml"/>
58 <exec executable="cp"> 81 <exec executable="cp">
59 <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/> 82 <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/>
60 <arg value="${basedir}/app/config/parameters_test.yml"/> 83 <arg value="${basedir}/app/config/parameters_test.yml"/>
61 </exec> 84 </exec>
62
63 <exec executable="php"> 85 <exec executable="php">
64 <arg value="${basedir}/bin/console"/> 86 <arg value="${basedir}/bin/console"/>
65 <arg value="cache:clear"/> 87 <arg value="cache:clear"/>
66 <arg value="--env=test"/> 88 <arg value="--env=test"/>
67 </exec> 89 </exec>
90 <exec executable="php">
91 <arg value="${basedir}/bin/console"/>
92 <arg value="doctrine:database:drop"/>
93 <arg value="--force"/>
94 <arg value="--env=test"/>
95 </exec>
96 <exec executable="php">
97 <arg value="${basedir}/bin/console"/>
98 <arg value="doctrine:database:create"/>
99 <arg value="--env=test"/>
100 </exec>
101 <exec executable="php">
102 <arg value="${basedir}/bin/console"/>
103 <arg value="doctrine:schema:create"/>
104 <arg value="--env=test"/>
105 </exec>
106 <exec executable="php">
107 <arg value="${basedir}/bin/console"/>
108 <arg value="doctrine:migrations:migrate"/>
109 <arg value="--no-interaction"/>
110 <arg value="--env=test"/>
111 </exec>
112 <exec executable="php">
113 <arg value="${basedir}/bin/console"/>
114 <arg value="doctrine:fixtures:load"/>
115 <arg value="--no-interaction"/>
116 <arg value="--env=test"/>
117 </exec>
68 </target> 118 </target>
69 119
70 <target name="db_pgsql" description="Run test for PostgreSQL"> 120 <target name="prepare_pgsql" description="Run test for PostgreSQL">
71 <delete dir="${basedir}/app/config/parameters.yml"/> 121 <delete dir="${basedir}/app/config/parameters.yml"/>
72 <exec executable="cp"> 122 <exec executable="cp">
73 <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/> 123 <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/>
74 <arg value="${basedir}/app/config/parameters_test.yml"/> 124 <arg value="${basedir}/app/config/parameters_test.yml"/>
75 </exec> 125 </exec>
76
77 <exec executable="php"> 126 <exec executable="php">
78 <arg value="${basedir}/bin/console"/> 127 <arg value="${basedir}/bin/console"/>
79 <arg value="cache:clear"/> 128 <arg value="cache:clear"/>
80 <arg value="--env=test"/> 129 <arg value="--env=test"/>
81 </exec> 130 </exec>
131 <exec executable="php">
132 <arg value="${basedir}/bin/console"/>
133 <arg value="doctrine:database:drop"/>
134 <arg value="--force"/>
135 <arg value="--env=test"/>
136 </exec>
137 <exec executable="php">
138 <arg value="${basedir}/bin/console"/>
139 <arg value="doctrine:database:create"/>
140 <arg value="--env=test"/>
141 </exec>
142 <exec executable="psql">
143 <arg value="-h"/>
144 <arg value="localhost"/>
145 <arg value="-d"/>
146 <arg value="wallabag_test"/>
147 <arg value="-U"/>
148 <arg value="travis"/>
149 <arg value="-f"/>
150 <arg value="data/sql/pgsql_base.sql"/>
151 </exec>
152 <exec executable="php">
153 <arg value="${basedir}/bin/console"/>
154 <arg value="doctrine:migrations:migrate"/>
155 <arg value="--no-interaction"/>
156 <arg value="--env=test"/>
157 </exec>
158 <exec executable="php">
159 <arg value="${basedir}/bin/console"/>
160 <arg value="doctrine:fixtures:load"/>
161 <arg value="--no-interaction"/>
162 <arg value="--env=test"/>
163 </exec>
82 </target> 164 </target>
83 165
84 <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> 166 <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage">
diff --git a/data/sql/mysql_base.sql b/data/sql/mysql_base.sql
new file mode 100644
index 00000000..13fa6302
--- /dev/null
+++ b/data/sql/mysql_base.sql
@@ -0,0 +1,25 @@
1CREATE 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;
2CREATE 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;
3CREATE 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;
4CREATE 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;
5CREATE 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;
6CREATE 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;
7CREATE 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;
8CREATE 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;
9CREATE 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;
10CREATE 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;
11CREATE 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;
12CREATE 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;
13ALTER TABLE `wallabag_entry` ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
14ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id);
15ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES `wallabag_tag` (id);
16ALTER TABLE `wallabag_config` ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
17ALTER TABLE `wallabag_tagging_rule` ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES `wallabag_config` (id);
18ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
19ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
20ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
21ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
22ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
23ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
24ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
25ALTER 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
new file mode 100644
index 00000000..6688fe83
--- /dev/null
+++ b/data/sql/pgsql_base.sql
@@ -0,0 +1,62 @@
1CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
2CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
3CREATE 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));
4CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
5CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(entry_id, tag_id));
6CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
7CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
8CREATE 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));
9CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
10CREATE 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));
11CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
12COMMENT ON COLUMN "wallabag_tagging_rule".tags IS '(DC2Type:simple_array)';
13CREATE TABLE "wallabag_tag" (id INT NOT NULL, label TEXT NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
14CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
15CREATE 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));
16COMMENT ON COLUMN wallabag_oauth2_clients.redirect_uris IS '(DC2Type:array)';
17COMMENT ON COLUMN wallabag_oauth2_clients.allowed_grant_types IS '(DC2Type:array)';
18CREATE 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));
19CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
20CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
21CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
22CREATE 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));
23CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
24CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
25CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
26CREATE 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));
27CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
28CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
29CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
30CREATE 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));
31CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
32CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
33CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
34COMMENT ON COLUMN "wallabag_user".roles IS '(DC2Type:array)';
35COMMENT ON COLUMN "wallabag_user".trusted IS '(DC2Type:json_array)';
36CREATE 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));
37CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
38CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
39COMMENT ON COLUMN wallabag_annotation.ranges IS '(DC2Type:array)';
40CREATE SEQUENCE "entry_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
41CREATE SEQUENCE "config_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
42CREATE SEQUENCE "tagging_rule_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
43CREATE SEQUENCE "tag_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
44CREATE SEQUENCE oauth2_clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
45CREATE SEQUENCE oauth2_access_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
46CREATE SEQUENCE oauth2_refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
47CREATE SEQUENCE oauth2_auth_codes_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
48CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
49CREATE SEQUENCE annotation_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
50ALTER TABLE "wallabag_entry" ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
51ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
52ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
53ALTER TABLE "wallabag_config" ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
54ALTER TABLE "wallabag_tagging_rule" ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
55ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
56ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
57ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
58ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
59ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
60ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
61ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
62ALTER 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
new file mode 100644
index 00000000..d2780d96
--- /dev/null
+++ b/data/sql/sqlite_base.sql
@@ -0,0 +1,33 @@
1CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
2CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
3CREATE 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);
4CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
5CREATE TABLE "wallabag_tag" (id INTEGER NOT NULL, label CLOB NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
6CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
7CREATE 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);
8CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
9CREATE 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);
10CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
11CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
12CREATE 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);
13CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
14CREATE 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);
15CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
16CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
17CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
18CREATE 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);
19CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
20CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
21CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
22CREATE 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);
23CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
24CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
25CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
26CREATE 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));
27CREATE 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));
28CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
29CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
30CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
31CREATE 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);
32CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
33CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php
index 427a4c7f..9ed9f980 100644
--- a/src/Wallabag/ApiBundle/Entity/Client.php
+++ b/src/Wallabag/ApiBundle/Entity/Client.php
@@ -22,7 +22,7 @@ class Client extends BaseClient
22 /** 22 /**
23 * @var string 23 * @var string
24 * 24 *
25 * @ORM\Column(name="name", type="text", nullable=true) 25 * @ORM\Column(name="name", type="text", nullable=false)
26 */ 26 */
27 protected $name; 27 protected $name;
28 28
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index 0b75270d..b902ae2c 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -93,7 +93,7 @@ class Config
93 /** 93 /**
94 * @var int 94 * @var int
95 * 95 *
96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true) 96 * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true, options={"default" = 0})
97 */ 97 */
98 private $actionMarkAsRead; 98 private $actionMarkAsRead;
99 99
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 3cf9ac1a..3ae5334f 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -183,7 +183,7 @@ class Entry
183 /** 183 /**
184 * @var string 184 * @var string
185 * 185 *
186 * @ORM\Column(name="http_status", type="text", nullable=true) 186 * @ORM\Column(name="http_status", type="string", length=3, nullable=true)
187 * 187 *
188 * @Groups({"entries_for_user", "export_all"}) 188 * @Groups({"entries_for_user", "export_all"})
189 */ 189 */