diff options
Diffstat (limited to 'app/DoctrineMigrations')
-rw-r--r-- | app/DoctrineMigrations/Version20170511211659.php | 26 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20190425115043.php | 2 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20190619093534.php | 2 |
3 files changed, 16 insertions, 14 deletions
diff --git a/app/DoctrineMigrations/Version20170511211659.php b/app/DoctrineMigrations/Version20170511211659.php index 00ce7b1f..d0752baf 100644 --- a/app/DoctrineMigrations/Version20170511211659.php +++ b/app/DoctrineMigrations/Version20170511211659.php | |||
@@ -13,19 +13,21 @@ class Version20170511211659 extends WallabagMigration | |||
13 | { | 13 | { |
14 | public function up(Schema $schema) | 14 | public function up(Schema $schema) |
15 | { | 15 | { |
16 | $tableName = $this->getTable('annotation'); | ||
17 | |||
18 | switch ($this->connection->getDatabasePlatform()->getName()) { | 16 | switch ($this->connection->getDatabasePlatform()->getName()) { |
19 | case 'sqlite': | 17 | case 'sqlite': |
18 | $annotationTableName = $this->getTable('annotation', true); | ||
19 | $userTableName = $this->getTable('user', true); | ||
20 | $entryTableName = $this->getTable('entry', true); | ||
21 | |||
20 | $this->addSql(<<<EOD | 22 | $this->addSql(<<<EOD |
21 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS | 23 | CREATE TEMPORARY TABLE __temp__wallabag_annotation AS |
22 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 24 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
23 | FROM ${tableName} | 25 | FROM ${annotationTableName} |
24 | EOD | 26 | EOD |
25 | ); | 27 | ); |
26 | $this->addSql('DROP TABLE ' . $tableName); | 28 | $this->addSql('DROP TABLE ' . $annotationTableName); |
27 | $this->addSql(<<<EOD | 29 | $this->addSql(<<<EOD |
28 | CREATE TABLE ${tableName} | 30 | CREATE TABLE ${annotationTableName} |
29 | ( | 31 | ( |
30 | id INTEGER PRIMARY KEY NOT NULL, | 32 | id INTEGER PRIMARY KEY NOT NULL, |
31 | user_id INTEGER DEFAULT NULL, | 33 | user_id INTEGER DEFAULT NULL, |
@@ -35,16 +37,16 @@ CREATE TABLE ${tableName} | |||
35 | updated_at DATETIME NOT NULL, | 37 | updated_at DATETIME NOT NULL, |
36 | quote CLOB NOT NULL, | 38 | quote CLOB NOT NULL, |
37 | ranges CLOB NOT NULL, | 39 | ranges CLOB NOT NULL, |
38 | CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES wallabag_user (id), | 40 | CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES ${userTableName} (id), |
39 | CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES wallabag_entry (id) ON DELETE CASCADE | 41 | CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES ${entryTableName} (id) ON DELETE CASCADE |
40 | ); | 42 | ); |
41 | CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id); | 43 | CREATE INDEX IDX_A7AED006A76ED395 ON ${annotationTableName} (user_id); |
42 | CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id); | 44 | CREATE INDEX IDX_A7AED006BA364942 ON ${annotationTableName} (entry_id); |
43 | EOD | 45 | EOD |
44 | ); | 46 | ); |
45 | 47 | ||
46 | $this->addSql(<<<EOD | 48 | $this->addSql(<<<EOD |
47 | INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) | 49 | INSERT INTO ${annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges) |
48 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges | 50 | SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges |
49 | FROM __temp__wallabag_annotation; | 51 | FROM __temp__wallabag_annotation; |
50 | EOD | 52 | EOD |
@@ -52,10 +54,10 @@ EOD | |||
52 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); | 54 | $this->addSql('DROP TABLE __temp__wallabag_annotation'); |
53 | break; | 55 | break; |
54 | case 'mysql': | 56 | case 'mysql': |
55 | $this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL'); | 57 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' MODIFY quote TEXT NOT NULL'); |
56 | break; | 58 | break; |
57 | case 'postgresql': | 59 | case 'postgresql': |
58 | $this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT'); | 60 | $this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ALTER COLUMN quote TYPE TEXT'); |
59 | break; | 61 | break; |
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/app/DoctrineMigrations/Version20190425115043.php b/app/DoctrineMigrations/Version20190425115043.php index 4c5c49cc..5c6ae494 100644 --- a/app/DoctrineMigrations/Version20190425115043.php +++ b/app/DoctrineMigrations/Version20190425115043.php | |||
@@ -17,7 +17,7 @@ final class Version20190425115043 extends WallabagMigration | |||
17 | $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); | 17 | $this->addSql('DROP INDEX UNIQ_87E64C53A76ED395'); |
18 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true)); | 18 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true)); |
19 | $this->addSql('DROP TABLE ' . $this->getTable('config', true)); | 19 | $this->addSql('DROP TABLE ' . $this->getTable('config', true)); |
20 | $this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | 20 | $this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); |
21 | $this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); | 21 | $this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true)); |
22 | $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); | 22 | $this->addSql('DROP TABLE __temp__' . $this->getTable('config', true)); |
23 | $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); | 23 | $this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)'); |
diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php index e9744f1b..9a062536 100644 --- a/app/DoctrineMigrations/Version20190619093534.php +++ b/app/DoctrineMigrations/Version20190619093534.php | |||
@@ -29,7 +29,7 @@ final class Version20190619093534 extends WallabagMigration | |||
29 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); | 29 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); |
30 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) | 30 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) |
31 | , headers CLOB DEFAULT NULL --(DC2Type:array) | 31 | , headers CLOB DEFAULT NULL --(DC2Type:array) |
32 | , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | 32 | , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); |
33 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM __temp__' . $this->getTable('entry', true) . ''); | 33 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM __temp__' . $this->getTable('entry', true) . ''); |
34 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); | 34 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); |
35 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); | 35 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); |