@@ -4,26 +4,26 @@ |
||
4 | 4 | |
5 | 5 | class m170904_201142_dds_multichoice_creation extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
9 | - $sql =<<<EOQ |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | + $sql =<<<EOQ |
|
10 | 10 | SET foreign_key_checks = 0; |
11 | 11 | REPLACE INTO `dds_data_type` (`data_type_ref`, `label`, `description`, `definition`, `storage_ref`, `deleted`) |
12 | 12 | VALUES |
13 | 13 | ('choice_multiple','Multiple Choice','For storing multiple choice keys','{"size":10000}','text',0); |
14 | 14 | SET foreign_key_checks = 1; |
15 | 15 | EOQ; |
16 | - $this->execute($sql); |
|
16 | + $this->execute($sql); |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function safeDown() |
|
21 | - { |
|
22 | - $sql =<<<EOQ |
|
20 | + public function safeDown() |
|
21 | + { |
|
22 | + $sql =<<<EOQ |
|
23 | 23 | SET foreign_key_checks=0; |
24 | 24 | DELETE FROM `dds_data_type` WHERE `data_type_ref`='choice_multiple'; |
25 | 25 | SET foreign_key_checks=1; |
26 | 26 | EOQ; |
27 | - $this->execute($sql); |
|
28 | - } |
|
27 | + $this->execute($sql); |
|
28 | + } |
|
29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | class m161111_161448__dds_removal_of_ids extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | // delete ids |
10 | 10 | $this->dropColumn('dds_class', 'id'); |
11 | 11 | $this->dropColumn('dds_data_type', 'id'); |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | |
15 | 15 | // add a uuid to object tables |
16 | 16 | $this->execute('ALTER TABLE `dds_object` ADD `_uuid` CHAR(36) NOT NULL FIRST, ADD PRIMARY KEY (`_uuid`)'); |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public function safeDown() |
|
20 | - { |
|
19 | + public function safeDown() |
|
20 | + { |
|
21 | 21 | // remove the uuid |
22 | 22 | $this->dropColumn('dds_object', '_uuid'); |
23 | 23 | // add ids back again |
@@ -25,5 +25,5 @@ discard block |
||
25 | 25 | $this->execute('ALTER TABLE `dds_data_type` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
26 | 26 | $this->execute('ALTER TABLE `dds_member` ADD `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)'); |
27 | 27 | $this->execute('ALTER TABLE `dds_object` ADD `_id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`_id`)'); |
28 | - } |
|
28 | + } |
|
29 | 29 | } |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class m161018_154331__dds_add_definition_to_class extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
9 | - $this->addColumn('dds_class', 'definition', $this->text(10000) . " DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
10 | - } |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | + $this->addColumn('dds_class', 'definition', $this->text(10000) . " DEFAULT NULL COMMENT 'A definition for use by other modules, but not understood by DDS'"); |
|
10 | + } |
|
11 | 11 | |
12 | - public function safeDown() |
|
13 | - { |
|
14 | - $this->dropColumn('dds_class', 'definition'); |
|
15 | - } |
|
12 | + public function safeDown() |
|
13 | + { |
|
14 | + $this->dropColumn('dds_class', 'definition'); |
|
15 | + } |
|
16 | 16 | } |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class m170724_112209_dds_link_table_creation extends Migration |
11 | 11 | { |
12 | - public function safeUp() |
|
13 | - { |
|
12 | + public function safeUp() |
|
13 | + { |
|
14 | 14 | // create a linking table for links |
15 | 15 | $tableOptions = null; |
16 | 16 | if ($this->db->driverName === 'mysql') { |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | - public function safeDown() |
|
44 | - { |
|
43 | + public function safeDown() |
|
44 | + { |
|
45 | 45 | $this->dropTable('dds_link'); |
46 | 46 | $connection = neon()->db; |
47 | 47 | $sql =<<<EOQ |
@@ -52,5 +52,5 @@ discard block |
||
52 | 52 | $this->execute($sql); |
53 | 53 | $this->dropColumn('dds_member', 'link_class'); |
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | } |
@@ -5,14 +5,14 @@ |
||
5 | 5 | class m161201_170340_dds_add_map_field_to_members extends Migration |
6 | 6 | { |
7 | 7 | |
8 | - public function safeUp() |
|
9 | - { |
|
8 | + public function safeUp() |
|
9 | + { |
|
10 | 10 | $this->addColumn('dds_member', 'map_field', "TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'If true, then this is field data used in defining maps' AFTER `definition`"); |
11 | - } |
|
11 | + } |
|
12 | 12 | |
13 | - public function safeDown() |
|
14 | - { |
|
13 | + public function safeDown() |
|
14 | + { |
|
15 | 15 | $this->dropColumn('dds_member', 'map_field'); |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | 18 | } |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class m161130_132511_dds_uuid_change_to_22_chars extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | $this->alterColumn('dds_object', '_uuid', "CHAR(22) NOT NULL COMMENT 'A universally unique identifier for this object'"); |
10 | - } |
|
10 | + } |
|
11 | 11 | |
12 | - public function safeDown() |
|
13 | - { |
|
12 | + public function safeDown() |
|
13 | + { |
|
14 | 14 | $this->alterColumn('dds_object', '_uuid', "CHAR(36) NOT NULL"); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | class m170107_201653_cms_create_cms_static_content_table_again extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | $cms_static = 'cms_static_content'; |
10 | 10 | |
11 | 11 | // recreate the table with the new structure |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | // } |
47 | 47 | // } |
48 | 48 | // } while ($count < $total); |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public function safeDown() |
|
52 | - { |
|
51 | + public function safeDown() |
|
52 | + { |
|
53 | 53 | $this->dropTable('cms_static_content'); |
54 | - } |
|
54 | + } |
|
55 | 55 | } |
@@ -7,23 +7,23 @@ |
||
7 | 7 | |
8 | 8 | class m170112_201653_cms_static_content_page_ids_to_uuid64 extends Migration |
9 | 9 | { |
10 | - public function safeUp() |
|
11 | - { |
|
12 | - $cms_static_content = CmsStaticContent::tableName(); |
|
10 | + public function safeUp() |
|
11 | + { |
|
12 | + $cms_static_content = CmsStaticContent::tableName(); |
|
13 | 13 | $cms_page = CmsPage::tableName(); |
14 | 14 | |
15 | 15 | // use a nice id |
16 | - $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
16 | + $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
17 | 17 | // update with nice_id's |
18 | 18 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.old_id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.id"); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | - public function safeDown() |
|
22 | - { |
|
21 | + public function safeDown() |
|
22 | + { |
|
23 | 23 | $cms_static_content = CmsStaticContent::tableName(); |
24 | 24 | $cms_page = CmsPage::tableName(); |
25 | 25 | |
26 | 26 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.old_id"); |
27 | 27 | $this->alterColumn($cms_static_content, 'page_id', $this->integer(11)->null()); |
28 | - } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | |
8 | 8 | class m170112_211700_change_dds_page_ids_to_uuid64 extends Migration |
9 | 9 | { |
10 | - public function safeUp() |
|
11 | - { |
|
12 | - $cms_page = CmsPage::tableName(); |
|
13 | - // Step 1 |
|
10 | + public function safeUp() |
|
11 | + { |
|
12 | + $cms_page = CmsPage::tableName(); |
|
13 | + // Step 1 |
|
14 | 14 | // ------ |
15 | - // loop through all members in the DDS and find all members with a definition using |
|
15 | + // loop through all members in the DDS and find all members with a definition using |
|
16 | 16 | // {class: neon\\cms\\form\\fields\\PageSelector} |
17 | 17 | // or where the definition uses a `dataMapKey` of `pages` and a `dataMapProvider` of `cms` |
18 | 18 | $members = neon()->db->query()->select('*')->from('dds_member')->where('definition LIKE \'{"class":"neon__cms__form__fields__PageSelector%\'')->all(); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | $this->dropColumn($cms_page, 'old_id'); |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - public function safeDown() |
|
53 | - { |
|
54 | - echo "There is no coming back from this!\n"; |
|
55 | - } |
|
52 | + public function safeDown() |
|
53 | + { |
|
54 | + echo "There is no coming back from this!\n"; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | \ No newline at end of file |