Completed
Push — master ( 2f39ac...d23d56 )
by Jan
08:52
created

Version1   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 186
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 147
c 1
b 0
f 0
dl 0
loc 186
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 41 1
B up() 0 135 2
A getDescription() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineMigrations;
6
7
use Doctrine\DBAL\DBALException;
8
use Doctrine\DBAL\Schema\Schema;
9
use Doctrine\Migrations\AbstractMigration;
10
11
/**
12
 * Auto-generated Migration: Please modify to your needs!
13
 */
14
final class Version1 extends AbstractMigration
15
{
16
    public function getDescription() : string
17
    {
18
        return '';
19
    }
20
21
    public function up(Schema $schema) : void
22
    {
23
        // this up() migration is auto-generated, please modify it to your needs
24
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
25
26
        $skip_this_version = false;
0 ignored issues
show
Unused Code introduced by
The assignment to $skip_this_version is dead and can be removed.
Loading history...
27
        try {
28
            //Check if we can use this migration method:
29
            $version = (int)$this->connection->fetchColumn("SELECT keyValue AS version FROM `internal` WHERE `keyName` = 'dbVersion'");
0 ignored issues
show
Unused Code introduced by
The assignment to $version is dead and can be removed.
Loading history...
30
31
            $this->skipIf(true, "Old Part-DB Database detected! Continue with upgrade...");
32
33
        } catch (DBALException $ex) {
34
            //when the table was not found, we can proceed, because we have an empty DB!
35
        }
36
37
38
        $this->addSql('CREATE TABLE `attachements` (id INT AUTO_INCREMENT NOT NULL, type_id INT DEFAULT NULL, element_id INT DEFAULT NULL, show_in_table TINYINT(1) NOT NULL, filename VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, class_name VARCHAR(255) NOT NULL, INDEX IDX_212B82DCC54C8C93 (type_id), INDEX IDX_212B82DC1F1F2A24 (element_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
39
        $this->addSql('CREATE TABLE `attachement_types` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_9A8C1C77727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
40
        $this->addSql('CREATE TABLE `categories` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, partname_hint LONGTEXT NOT NULL, partname_regex LONGTEXT NOT NULL, disable_footprints TINYINT(1) NOT NULL, disable_manufacturers TINYINT(1) NOT NULL, disable_autodatasheets TINYINT(1) NOT NULL, disable_properties TINYINT(1) NOT NULL, default_description LONGTEXT NOT NULL, default_comment LONGTEXT NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_3AF34668727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
41
        $this->addSql('CREATE TABLE `devices` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, order_quantity INT NOT NULL, order_only_missing_parts TINYINT(1) NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_11074E9A727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
42
        $this->addSql('CREATE TABLE `device_parts` (id INT AUTO_INCREMENT NOT NULL, id_device INT DEFAULT NULL, id_part INT DEFAULT NULL, quantity INT NOT NULL, mountnames LONGTEXT NOT NULL, INDEX IDX_AFC547992F180363 (id_device), INDEX IDX_AFC54799C22F6CC4 (id_part), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
43
        $this->addSql('CREATE TABLE `footprints` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, filename MEDIUMTEXT NOT NULL, filename_3d MEDIUMTEXT NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_A34D68A2727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
44
        $this->addSql('CREATE TABLE `groups` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, perms_system INT NOT NULL, perms_groups INT NOT NULL, perms_users INT NOT NULL, perms_self INT NOT NULL, perms_system_config INT NOT NULL, perms_system_database INT NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_instock SMALLINT NOT NULL, perms_parts_mininstock SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_storelocation SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INT NOT NULL, perms_devices_parts INT NOT NULL, perms_storelocations INT NOT NULL, perms_footprints INT NOT NULL, perms_categories INT NOT NULL, perms_suppliers INT NOT NULL, perms_manufacturers INT NOT NULL, perms_attachement_types INT NOT NULL, perms_tools INT NOT NULL, perms_labels INT NOT NULL, INDEX IDX_F06D3970727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
45
        $this->addSql('CREATE TABLE `manufacturers` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_94565B12727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
46
        $this->addSql('CREATE TABLE `orderdetails` (id INT AUTO_INCREMENT NOT NULL, part_id INT DEFAULT NULL, id_supplier INT DEFAULT NULL, supplierpartnr VARCHAR(255) NOT NULL, obsolete TINYINT(1) NOT NULL, supplier_product_url VARCHAR(255) NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_489AFCDC4CE34BEC (part_id), INDEX IDX_489AFCDCCBF180EB (id_supplier), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
47
        $this->addSql('CREATE TABLE `parts` (id INT AUTO_INCREMENT NOT NULL, id_category INT DEFAULT NULL, id_footprint INT DEFAULT NULL, id_storelocation INT DEFAULT NULL, id_manufacturer INT DEFAULT NULL, id_master_picture_attachement INT DEFAULT NULL, order_orderdetails_id INT DEFAULT NULL, datetime_added DATETIME NOT NULL, last_modified DATETIME NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, instock INT NOT NULL, mininstock INT NOT NULL, comment LONGTEXT NOT NULL, visible TINYINT(1) NOT NULL, favorite TINYINT(1) NOT NULL, order_quantity INT NOT NULL, manual_order TINYINT(1) NOT NULL, manufacturer_product_url VARCHAR(255) NOT NULL, INDEX IDX_6940A7FE5697F554 (id_category), INDEX IDX_6940A7FE7E371A10 (id_footprint), INDEX IDX_6940A7FE8DF69834 (id_storelocation), INDEX IDX_6940A7FE1ECB93AE (id_manufacturer), INDEX IDX_6940A7FEEBBCC786 (id_master_picture_attachement), UNIQUE INDEX UNIQ_6940A7FE81081E9B (order_orderdetails_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
48
        $this->addSql('CREATE TABLE `pricedetails` (id INT AUTO_INCREMENT NOT NULL, orderdetails_id INT DEFAULT NULL, price NUMERIC(11, 5) NOT NULL, price_related_quantity INT NOT NULL, min_discount_quantity INT NOT NULL, manual_input TINYINT(1) NOT NULL, last_modified DATETIME NOT NULL, INDEX IDX_C68C44594A01DDC7 (orderdetails_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
49
        $this->addSql('CREATE TABLE `storelocations` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, is_full TINYINT(1) NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_7517020727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
50
        $this->addSql('CREATE TABLE `suppliers` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, address VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL, fax_number VARCHAR(255) NOT NULL, email_address VARCHAR(255) NOT NULL, website VARCHAR(255) NOT NULL, auto_product_url VARCHAR(255) NOT NULL, comment LONGTEXT NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_AC28B95C727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
51
        $this->addSql('CREATE TABLE `users` (id INT AUTO_INCREMENT NOT NULL, group_id INT DEFAULT NULL, name VARCHAR(180) NOT NULL, password VARCHAR(255) DEFAULT NULL, need_pw_change TINYINT(1) NOT NULL, first_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, department VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, config_language VARCHAR(255) DEFAULT NULL, config_timezone VARCHAR(255) DEFAULT NULL, config_theme VARCHAR(255) DEFAULT NULL, config_currency VARCHAR(255) NOT NULL, config_image_path LONGTEXT NOT NULL, config_instock_comment_w LONGTEXT NOT NULL, config_instock_comment_a LONGTEXT NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, perms_system INT NOT NULL, perms_groups INT NOT NULL, perms_users INT NOT NULL, perms_self INT NOT NULL, perms_system_config INT NOT NULL, perms_system_database INT NOT NULL, perms_parts BIGINT NOT NULL, perms_parts_name SMALLINT NOT NULL, perms_parts_description SMALLINT NOT NULL, perms_parts_instock SMALLINT NOT NULL, perms_parts_mininstock SMALLINT NOT NULL, perms_parts_footprint SMALLINT NOT NULL, perms_parts_storelocation SMALLINT NOT NULL, perms_parts_manufacturer SMALLINT NOT NULL, perms_parts_comment SMALLINT NOT NULL, perms_parts_order SMALLINT NOT NULL, perms_parts_orderdetails SMALLINT NOT NULL, perms_parts_prices SMALLINT NOT NULL, perms_parts_attachements SMALLINT NOT NULL, perms_devices INT NOT NULL, perms_devices_parts INT NOT NULL, perms_storelocations INT NOT NULL, perms_footprints INT NOT NULL, perms_categories INT NOT NULL, perms_suppliers INT NOT NULL, perms_manufacturers INT NOT NULL, perms_attachement_types INT NOT NULL, perms_tools INT NOT NULL, perms_labels INT NOT NULL, UNIQUE INDEX UNIQ_1483A5E95E237E06 (name), INDEX IDX_1483A5E9FE54D947 (group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
52
        $this->addSql('ALTER TABLE `attachements` ADD CONSTRAINT FK_212B82DCC54C8C93 FOREIGN KEY (type_id) REFERENCES `attachement_types` (id)');
53
        $this->addSql('ALTER TABLE `attachements` ADD CONSTRAINT FK_212B82DC1F1F2A24 FOREIGN KEY (element_id) REFERENCES `parts` (id)');
54
        $this->addSql('ALTER TABLE `attachement_types` ADD CONSTRAINT FK_9A8C1C77727ACA70 FOREIGN KEY (parent_id) REFERENCES `attachement_types` (id)');
55
        $this->addSql('ALTER TABLE `categories` ADD CONSTRAINT FK_3AF34668727ACA70 FOREIGN KEY (parent_id) REFERENCES `categories` (id)');
56
        $this->addSql('ALTER TABLE `devices` ADD CONSTRAINT FK_11074E9A727ACA70 FOREIGN KEY (parent_id) REFERENCES `devices` (id)');
57
        $this->addSql('ALTER TABLE `device_parts` ADD CONSTRAINT FK_AFC547992F180363 FOREIGN KEY (id_device) REFERENCES `devices` (id)');
58
        $this->addSql('ALTER TABLE `device_parts` ADD CONSTRAINT FK_AFC54799C22F6CC4 FOREIGN KEY (id_part) REFERENCES `parts` (id)');
59
        $this->addSql('ALTER TABLE `footprints` ADD CONSTRAINT FK_A34D68A2727ACA70 FOREIGN KEY (parent_id) REFERENCES `footprints` (id)');
60
        $this->addSql('ALTER TABLE `groups` ADD CONSTRAINT FK_F06D3970727ACA70 FOREIGN KEY (parent_id) REFERENCES `groups` (id)');
61
        $this->addSql('ALTER TABLE `manufacturers` ADD CONSTRAINT FK_94565B12727ACA70 FOREIGN KEY (parent_id) REFERENCES `manufacturers` (id)');
62
        $this->addSql('ALTER TABLE `orderdetails` ADD CONSTRAINT FK_489AFCDC4CE34BEC FOREIGN KEY (part_id) REFERENCES `parts` (id)');
63
        $this->addSql('ALTER TABLE `orderdetails` ADD CONSTRAINT FK_489AFCDCCBF180EB FOREIGN KEY (id_supplier) REFERENCES `suppliers` (id)');
64
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FE5697F554 FOREIGN KEY (id_category) REFERENCES `categories` (id)');
65
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FE7E371A10 FOREIGN KEY (id_footprint) REFERENCES `footprints` (id)');
66
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FE8DF69834 FOREIGN KEY (id_storelocation) REFERENCES `storelocations` (id)');
67
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FE1ECB93AE FOREIGN KEY (id_manufacturer) REFERENCES `manufacturers` (id)');
68
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FEEBBCC786 FOREIGN KEY (id_master_picture_attachement) REFERENCES `attachements` (id)');
69
        $this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FE81081E9B FOREIGN KEY (order_orderdetails_id) REFERENCES `orderdetails` (id)');
70
        $this->addSql('ALTER TABLE `pricedetails` ADD CONSTRAINT FK_C68C44594A01DDC7 FOREIGN KEY (orderdetails_id) REFERENCES `orderdetails` (id)');
71
        $this->addSql('ALTER TABLE `storelocations` ADD CONSTRAINT FK_7517020727ACA70 FOREIGN KEY (parent_id) REFERENCES `storelocations` (id)');
72
        $this->addSql('ALTER TABLE `suppliers` ADD CONSTRAINT FK_AC28B95C727ACA70 FOREIGN KEY (parent_id) REFERENCES `suppliers` (id)');
73
        $this->addSql('ALTER TABLE `users` ADD CONSTRAINT FK_1483A5E9FE54D947 FOREIGN KEY (group_id) REFERENCES `groups` (id)');
74
75
        //Create table for user logs:
76
        $sql =  $updateSteps[] = "CREATE TABLE `log` ".
0 ignored issues
show
Comprehensibility Best Practice introduced by
$updateSteps was never initialized. Although not strictly required by PHP, it is generally a good practice to add $updateSteps = array(); before regardless.
Loading history...
77
            "( `id` INT NOT NULL AUTO_INCREMENT , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ,".
78
            " `id_user` INT NOT NULL ,".
79
            " `level` TINYINT NOT NULL ,".
80
            " `type` SMALLINT NOT NULL ,".
81
            " `target_id` INT NOT NULL ,".
82
            " `target_type` SMALLINT NOT NULL ,".
83
            " `extra` MEDIUMTEXT NOT NULL ,".
84
            " PRIMARY KEY (`id`),".
85
            " INDEX (`id_user`)) ENGINE = InnoDB;";
86
87
        $this->addSql($sql);
88
89
        //Create first groups and users:
90
91
        //Add needed groups.
92
        $sql = <<<'EOD'
93
                INSERT INTO `groups`
94
                (`id`,`name`,`parent_id`,`comment`,`perms_system`,`perms_groups`,
95
                `perms_users`,
96
                `perms_self`,`perms_system_config`,`perms_system_database`,
97
                `perms_parts`,`perms_parts_name`,`perms_parts_description`,
98
                `perms_parts_instock`,`perms_parts_mininstock`,
99
                `perms_parts_footprint`,`perms_parts_storelocation`,
100
                `perms_parts_manufacturer`,`perms_parts_comment`,
101
                `perms_parts_order`,`perms_parts_orderdetails`,`perms_parts_prices`
102
                ,`perms_parts_attachements`,`perms_devices`,`perms_devices_parts`,
103
                `perms_storelocations`,`perms_footprints`,`perms_categories`,
104
                `perms_suppliers`,`perms_manufacturers`,`perms_attachement_types`,
105
                `perms_tools`)
106
                VALUES (1, 'admins', NULL, 'Users of this group can do everything: Read, Write and Administrative actions.',
107
                    21, 1365, 87381, 85, 85, 21, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461,
108
                    5461, 5461, 5461, 1365, 1365),
109
                (2, 'readonly', NULL, 
110
                   'Users of this group can only read informations, use tools, and don\'t have access to administrative tools.', 
111
                    42, 2730, 174762, 154, 170, 42, -1516939607, 9, 9, 9, 9, 9, 9, 9, 9, 9, 649, 649, 649, 1705, 649, 1705, 1705,
112
                    1705, 1705, 1705, 681, 1366),
113
                (3, 'users', NULL,
114
                    'Users of this group, can edit part informations, create new ones, etc. but are not allowed to use administrative tools. (But can read current configuration, and see Server status)',
115
                    42, 2730, 109226, 89, 105, 41, 1431655765, 5, 5, 5, 5, 5, 5, 5, 5, 5, 325, 325, 325, 5461, 325, 5461, 5461, 5461,
116
                    5461, 5461, 1365, 1365); 
117
EOD;
118
119
        $this->addSql($sql);
120
121
        $admin_pw = "$2y$10$36AnqCBS.YnHlVdM4UQ0oOCV7BjU7NmE0qnAVEex65AyZw1cbcEjq";
122
123
        $sql = <<<EOD
124
            INSERT INTO `users`
125
            (`id`,`name`,`password`,`first_name`,`last_name`,`department`,
126
             `email`,
127
             `need_pw_change`,`group_id`,`perms_system`,`perms_groups`,
128
             `perms_users`,`perms_self`,`perms_system_config`,
129
             `perms_system_database`,`perms_parts`,`perms_parts_name`,
130
             `perms_parts_description`,`perms_parts_instock`,
131
             `perms_parts_mininstock`,`perms_parts_footprint`,
132
             `perms_parts_storelocation`,`perms_parts_manufacturer`,
133
             `perms_parts_comment`,`perms_parts_order`,
134
             `perms_parts_orderdetails`,`perms_parts_prices`,
135
             `perms_parts_attachements`,`perms_devices`,`perms_devices_parts`,
136
             `perms_storelocations`,`perms_footprints`,`perms_categories`,
137
             `perms_suppliers`,`perms_manufacturers`,`perms_attachement_types`,
138
             `perms_tools`)
139
              VALUES (1,'anonymous','','','','','',0,2,21844,20480,0,0,0,0,0,21840,21840,
140
             21840,21840,
141
             21840,21840,21840,21840,21840,21520,21520,21520,20480,21520,20480,
142
             20480,20480,20480,20480,21504,20480),
143
              (
144
              2,'admin', '$admin_pw','','',
145
              '','',1,1,21845,21845,21845,21,85,21,349525,21845,21845,21845,21845
146
              ,21845,21845,21845,21845,21845,21845,21845,21845,21845,21845,21845,
147
              21845,21845,21845,21845,21845,21845); 
148
EOD;
149
150
        $this->addSql($sql);
151
152
        //Allow users and admins full use of labels. readonly can not write/delete profiles.
153
        $this->addSql("UPDATE `groups` SET `perms_labels` = '85' WHERE `groups`.`id` = 1;");
154
        $this->addSql("UPDATE `groups` SET `perms_labels` = '165' WHERE `groups`.`id` = 2;");
155
        $this->addSql("UPDATE `groups` SET `perms_labels` = '85' WHERE `groups`.`id` = 3;");
156
157
    }
158
159
    public function down(Schema $schema) : void
160
    {
161
        // this down() migration is auto-generated, please modify it to your needs
162
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
163
164
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FEEBBCC786');
165
        $this->addSql('ALTER TABLE `attachements` DROP FOREIGN KEY FK_212B82DCC54C8C93');
166
        $this->addSql('ALTER TABLE `attachement_types` DROP FOREIGN KEY FK_9A8C1C77727ACA70');
167
        $this->addSql('ALTER TABLE `categories` DROP FOREIGN KEY FK_3AF34668727ACA70');
168
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE5697F554');
169
        $this->addSql('ALTER TABLE `devices` DROP FOREIGN KEY FK_11074E9A727ACA70');
170
        $this->addSql('ALTER TABLE `device_parts` DROP FOREIGN KEY FK_AFC547992F180363');
171
        $this->addSql('ALTER TABLE `footprints` DROP FOREIGN KEY FK_A34D68A2727ACA70');
172
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE7E371A10');
173
        $this->addSql('ALTER TABLE `groups` DROP FOREIGN KEY FK_F06D3970727ACA70');
174
        $this->addSql('ALTER TABLE `users` DROP FOREIGN KEY FK_1483A5E9FE54D947');
175
        $this->addSql('ALTER TABLE `manufacturers` DROP FOREIGN KEY FK_94565B12727ACA70');
176
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE1ECB93AE');
177
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE81081E9B');
178
        $this->addSql('ALTER TABLE `pricedetails` DROP FOREIGN KEY FK_C68C44594A01DDC7');
179
        $this->addSql('ALTER TABLE `attachements` DROP FOREIGN KEY FK_212B82DC1F1F2A24');
180
        $this->addSql('ALTER TABLE `device_parts` DROP FOREIGN KEY FK_AFC54799C22F6CC4');
181
        $this->addSql('ALTER TABLE `orderdetails` DROP FOREIGN KEY FK_489AFCDC4CE34BEC');
182
        $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE8DF69834');
183
        $this->addSql('ALTER TABLE `storelocations` DROP FOREIGN KEY FK_7517020727ACA70');
184
        $this->addSql('ALTER TABLE `orderdetails` DROP FOREIGN KEY FK_489AFCDCCBF180EB');
185
        $this->addSql('ALTER TABLE `suppliers` DROP FOREIGN KEY FK_AC28B95C727ACA70');
186
        $this->addSql('DROP TABLE `attachements`');
187
        $this->addSql('DROP TABLE `attachement_types`');
188
        $this->addSql('DROP TABLE `categories`');
189
        $this->addSql('DROP TABLE `devices`');
190
        $this->addSql('DROP TABLE `device_parts`');
191
        $this->addSql('DROP TABLE `footprints`');
192
        $this->addSql('DROP TABLE `groups`');
193
        $this->addSql('DROP TABLE `manufacturers`');
194
        $this->addSql('DROP TABLE `orderdetails`');
195
        $this->addSql('DROP TABLE `parts`');
196
        $this->addSql('DROP TABLE `pricedetails`');
197
        $this->addSql('DROP TABLE `storelocations`');
198
        $this->addSql('DROP TABLE `suppliers`');
199
        $this->addSql('DROP TABLE `users`');
200
    }
201
}
202