@@ 11-34 (lines=24) @@ | ||
8 | /** |
|
9 | * Migration to add syslog_maillog_lastdate to table sysconfig. |
|
10 | */ |
|
11 | class Version20170510222222 extends AbstractMigration |
|
12 | { |
|
13 | /** |
|
14 | * @param Schema $schema |
|
15 | */ |
|
16 | public function up(Schema $schema) |
|
17 | { |
|
18 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
19 | ||
20 | $this->addSql('INSERT IGNORE INTO sysconfig VALUES (\'syslog_maillog_lastdate\', \'2017-05-01 00:00:01\')'); |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * @param Schema $schema |
|
25 | */ |
|
26 | public function down(Schema $schema) |
|
27 | { |
|
28 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
|
29 | ||
30 | $this->addSql('DROP TABLE field_note'); |
|
31 | } |
|
32 | } |
|
33 |
@@ 11-55 (lines=45) @@ | ||
8 | /** |
|
9 | * Migration to create page and page_block table. |
|
10 | */ |
|
11 | class Version20170516084212 extends AbstractMigration |
|
12 | { |
|
13 | /** |
|
14 | * @param Schema $schema |
|
15 | * @return void |
|
16 | */ |
|
17 | public function up(Schema $schema) |
|
18 | { |
|
19 | $this->abortIf( |
|
20 | $this->connection->getDatabasePlatform()->getName() != 'mysql', |
|
21 | 'Migration can only be executed safely on \'mysql\'.' |
|
22 | ); |
|
23 | ||
24 | $this->addSql(' |
|
25 | CREATE TABLE IF NOT EXISTS page_block( |
|
26 | id INT AUTO_INCREMENT NOT null, |
|
27 | page_id INT NOT null, |
|
28 | locale VARCHAR(2) NOT NULL, |
|
29 | title VARCHAR(255) NOT null, |
|
30 | html LONGTEXT NOT null, |
|
31 | position INT DEFAULT null, |
|
32 | updated_at DATETIME NOT null, |
|
33 | active TINYINT(1) NOT null, |
|
34 | PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; |
|
35 | '); |
|
36 | ||
37 | $this->addSql(' |
|
38 | CREATE TABLE IF NOT EXISTS page( |
|
39 | id INT AUTO_INCREMENT NOT null, |
|
40 | slug VARCHAR(80) NOT null UNIQUE , |
|
41 | meta_keywords VARCHAR(255) NOT null, |
|
42 | meta_description VARCHAR(255) DEFAULT null, |
|
43 | meta_social LONGTEXT DEFAULT null, |
|
44 | updated_at DATETIME NOT null, |
|
45 | active TINYINT(1) NOT null, |
|
46 | PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; |
|
47 | '); |
|
48 | ||
49 | $this->addSql('ALTER TABLE page_block ADD FOREIGN KEY (page_id) REFERENCES page(id);'); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * @param Schema $schema |
|
54 | * @return void |
|
55 | */ |
|
56 | public function down(Schema $schema) |
|
57 | { |
|
58 | } |