Version0_15_0::down()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 77
Code Lines 73

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 73
nc 2
nop 1
dl 0
loc 77
rs 8.589
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace App\Migration;
4
5
use Doctrine\DBAL\Schema\Schema;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Schema\Schema was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Doctrine\Migrations\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Doctrine\Migrations\AbstractMigration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Doctrine\DBAL\Migrations\Version;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Migrations\Version was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Ds\Component\Acl\Migration\Version0_15_0 as Acl;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Acl\Migration\Version0_15_0 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Ds\Component\Config\Migration\Version0_15_0 as Config;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Config\Migration\Version0_15_0 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Ds\Component\Container\Attribute;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Container\Attribute was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Ds\Component\Database\Util\Objects;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Database\Util\Objects was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Ds\Component\Database\Util\Parameters;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Database\Util\Parameters was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Ds\Component\Metadata\Migration\Version0_15_0 as Metadata;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Metadata\Migration\Version0_15_0 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Ds\Component\Parameter\Migration\Version0_15_0 as Parameter;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Parameter\Migration\Version0_15_0 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Ds\Component\Tenant\Migration\Version0_15_0 as Tenant;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Tenant\Migration\Version0_15_0 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Ramsey\Uuid\Uuid;
0 ignored issues
show
Bug introduced by
The type Ramsey\Uuid\Uuid was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ContainerAwareInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * Class Version0_15_0
21
 */
22
final class Version0_15_0 extends AbstractMigration implements ContainerAwareInterface
23
{
24
    use Attribute\Container;
0 ignored issues
show
Bug introduced by
The type Ds\Component\Container\Attribute\Container was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
26
    /**
27
     * @cont string
28
     */
29
    const DIRECTORY = '/srv/api/config/migrations';
30
31
    /**
32
     * @var \Ds\Component\Acl\Migration\Version0_15_0
33
     */
34
    private $acl;
35
36
    /**
37
     * @var \Ds\Component\Config\Migration\Version0_15_0
38
     */
39
    private $config;
40
41
    /**
42
     * @var \Ds\Component\Metadata\Migration\Version0_15_0
43
     */
44
    private $metadata;
45
46
    /**
47
     * @var \Ds\Component\Parameter\Migration\Version0_15_0
48
     */
49
    private $parameter;
50
51
    /**
52
     * @var \Ds\Component\Tenant\Migration\Version0_15_0
53
     */
54
    private $tenant;
55
56
    /**
57
     * Constructor
58
     *
59
     * @param \Doctrine\DBAL\Migrations\Version  $version
60
     */
61
    public function __construct(Version $version)
62
    {
63
        parent::__construct($version);
64
        $this->acl = new Acl($version);
65
        $this->config = new Config($version);
66
        $this->metadata = new Metadata($version);
67
        $this->parameter = new Parameter($version);
68
        $this->tenant = new Tenant($version);
69
    }
70
71
    /**
72
     * Up migration
73
     *
74
     * @param \Doctrine\DBAL\Schema\Schema $schema
75
     */
76
    public function up(Schema $schema)
77
    {
78
        $parameters = Parameters::parseFile(static::DIRECTORY.'/parameters.yaml');
79
        $this->acl->up($schema, Objects::parseFile(static::DIRECTORY.'/0_15_0/acl.yaml', $parameters));
80
        $this->config->setContainer($this->container)->up($schema, Objects::parseFile(static::DIRECTORY.'/0_15_0/config.yaml', $parameters));
81
        $this->metadata->up($schema, Objects::parseFile(static::DIRECTORY.'/0_15_0/metadata.yaml', $parameters));
82
        $this->parameter->setContainer($this->container)->up($schema, Objects::parseFile(static::DIRECTORY.'/0_15_0/system/parameter.yaml', $parameters));
83
        $this->tenant->up($schema, Objects::parseFile(static::DIRECTORY.'/0_15_0/system/tenant.yaml', $parameters));
84
85
        $businessUnits = Objects::parseFile(static::DIRECTORY.'/0_15_0/business_unit.yaml', $parameters);
86
        $roles = Objects::parseFile(static::DIRECTORY.'/0_15_0/role.yaml', $parameters);
87
        $staffs = Objects::parseFile(static::DIRECTORY.'/0_15_0/staff.yaml', $parameters);
88
        $systems = Objects::parseFile(static::DIRECTORY.'/0_15_0/system.yaml', $parameters);
89
90
        $ids = [];
91
        $sequences['app_anonymous_id_seq'] = 1;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$sequences was never initialized. Although not strictly required by PHP, it is generally a good practice to add $sequences = array(); before regardless.
Loading history...
92
        $sequences['app_anonymous_persona_id_seq'] = 1;
93
        $sequences['app_anonymous_persona_trans_id_seq'] = 1;
94
        $sequences['app_bu_id_seq'] = 1 + count($businessUnits);
95
        $sequences['app_bu_trans_id_seq'] = 1;
96
        $sequences['app_individual_id_seq'] = 1;
97
        $sequences['app_individual_persona_id_seq'] = 1;
98
        $sequences['app_individual_persona_trans_id_seq'] = 1;
99
        $sequences['app_organization_id_seq'] = 1;
100
        $sequences['app_organization_persona_id_seq'] = 1;
101
        $sequences['app_organization_persona_trans_id_seq'] = 1;
102
        $sequences['app_role_id_seq'] = 1 + count($roles);
103
        $sequences['app_role_trans_id_seq'] = 1;
104
        $sequences['app_staff_id_seq'] = 1 + count($staffs);
105
        $sequences['app_staff_persona_id_seq'] = 1;
106
        $sequences['app_staff_persona_trans_id_seq'] = 1;
107
        $sequences['app_system_id_seq'] = 1 + count($businessUnits);
108
109
        foreach ($businessUnits as $businessUnit) {
110
            $sequences['app_bu_trans_id_seq'] += count((array) $businessUnit->title);
111
        }
112
113
        foreach ($roles as $role) {
114
            $sequences['app_role_trans_id_seq'] += count((array) $role->title);
115
        }
116
117
        foreach ($staffs as $staff) {
118
            $sequences['app_staff_persona_id_seq'] += count((array) $staff->personas);
119
120
            foreach ($staff->personas as $persona) {
121
                $sequences['app_staff_persona_trans_id_seq'] += count((array) $persona->title);
122
            }
123
        }
124
125
        switch ($this->platform->getName()) {
126
            case 'postgresql':
127
                $this->addSql('CREATE SEQUENCE app_anonymous_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_anonymous_id_seq']);
128
                $this->addSql('CREATE SEQUENCE app_anonymous_persona_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_anonymous_persona_id_seq']);
129
                $this->addSql('CREATE SEQUENCE app_anonymous_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_anonymous_persona_trans_id_seq']);
130
                $this->addSql('CREATE SEQUENCE app_bu_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_bu_id_seq']);
131
                $this->addSql('CREATE SEQUENCE app_bu_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_bu_trans_id_seq']);
132
                $this->addSql('CREATE SEQUENCE app_individual_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_individual_id_seq']);
133
                $this->addSql('CREATE SEQUENCE app_individual_persona_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_individual_persona_id_seq']);
134
                $this->addSql('CREATE SEQUENCE app_individual_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_individual_persona_trans_id_seq']);
135
                $this->addSql('CREATE SEQUENCE app_organization_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_organization_id_seq']);
136
                $this->addSql('CREATE SEQUENCE app_organization_persona_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_organization_persona_id_seq']);
137
                $this->addSql('CREATE SEQUENCE app_organization_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_organization_persona_trans_id_seq']);
138
                $this->addSql('CREATE SEQUENCE app_role_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_role_id_seq']);
139
                $this->addSql('CREATE SEQUENCE app_role_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_role_trans_id_seq']);
140
                $this->addSql('CREATE SEQUENCE app_staff_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_staff_id_seq']);
141
                $this->addSql('CREATE SEQUENCE app_staff_persona_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_staff_persona_id_seq']);
142
                $this->addSql('CREATE SEQUENCE app_staff_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_staff_persona_trans_id_seq']);
143
                $this->addSql('CREATE SEQUENCE app_system_id_seq INCREMENT BY 1 MINVALUE 1 START '.$sequences['app_system_id_seq']);
144
                $this->addSql('CREATE TABLE app_anonymous (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
145
                $this->addSql('CREATE UNIQUE INDEX UNIQ_6A5EB29BD17F50A6 ON app_anonymous (uuid)');
146
                $this->addSql('CREATE TABLE app_anonymous_role (anonymous_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(anonymous_id, role_id))');
147
                $this->addSql('CREATE INDEX IDX_E2D1EAF6FA93803 ON app_anonymous_role (anonymous_id)');
148
                $this->addSql('CREATE INDEX IDX_E2D1EAF6D60322AC ON app_anonymous_role (role_id)');
149
                $this->addSql('CREATE TABLE app_anonymous_persona (id INT NOT NULL, anonymous_id INT DEFAULT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
150
                $this->addSql('CREATE UNIQUE INDEX UNIQ_5ABA7A3D17F50A6 ON app_anonymous_persona (uuid)');
151
                $this->addSql('CREATE INDEX IDX_5ABA7A3FA93803 ON app_anonymous_persona (anonymous_id)');
152
                $this->addSql('COMMENT ON COLUMN app_anonymous_persona.data IS \'(DC2Type:json_array)\'');
153
                $this->addSql('CREATE TABLE app_anonymous_persona_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
154
                $this->addSql('CREATE INDEX IDX_3B378E082C2AC5D3 ON app_anonymous_persona_trans (translatable_id)');
155
                $this->addSql('CREATE UNIQUE INDEX app_anonymous_persona_trans_unique_translation ON app_anonymous_persona_trans (translatable_id, locale)');
156
                $this->addSql('CREATE TABLE app_bu (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
157
                $this->addSql('CREATE UNIQUE INDEX UNIQ_F0C3D814D17F50A6 ON app_bu (uuid)');
158
                $this->addSql('CREATE TABLE app_bu_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
159
                $this->addSql('CREATE INDEX IDX_AE7B40C2C2AC5D3 ON app_bu_trans (translatable_id)');
160
                $this->addSql('CREATE UNIQUE INDEX app_bu_trans_unique_translation ON app_bu_trans (translatable_id, locale)');
161
                $this->addSql('CREATE TABLE app_individual (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
162
                $this->addSql('CREATE UNIQUE INDEX UNIQ_D188576BD17F50A6 ON app_individual (uuid)');
163
                $this->addSql('CREATE TABLE app_individual_role (individual_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(individual_id, role_id))');
164
                $this->addSql('CREATE INDEX IDX_C5713550AE271C0D ON app_individual_role (individual_id)');
165
                $this->addSql('CREATE INDEX IDX_C5713550D60322AC ON app_individual_role (role_id)');
166
                $this->addSql('CREATE TABLE app_individual_persona (id INT NOT NULL, individual_id INT DEFAULT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
167
                $this->addSql('CREATE UNIQUE INDEX UNIQ_828FC6ED17F50A6 ON app_individual_persona (uuid)');
168
                $this->addSql('CREATE INDEX IDX_828FC6EAE271C0D ON app_individual_persona (individual_id)');
169
                $this->addSql('COMMENT ON COLUMN app_individual_persona.data IS \'(DC2Type:json_array)\'');
170
                $this->addSql('CREATE TABLE app_individual_persona_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
171
                $this->addSql('CREATE INDEX IDX_2EB6F73E2C2AC5D3 ON app_individual_persona_trans (translatable_id)');
172
                $this->addSql('CREATE UNIQUE INDEX app_individual_persona_trans_unique_translation ON app_individual_persona_trans (translatable_id, locale)');
173
                $this->addSql('CREATE TABLE app_organization (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
174
                $this->addSql('CREATE UNIQUE INDEX UNIQ_36079FDD17F50A6 ON app_organization (uuid)');
175
                $this->addSql('CREATE TABLE app_organization_role (organization_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(organization_id, role_id))');
176
                $this->addSql('CREATE INDEX IDX_CF25196832C8A3DE ON app_organization_role (organization_id)');
177
                $this->addSql('CREATE INDEX IDX_CF251968D60322AC ON app_organization_role (role_id)');
178
                $this->addSql('CREATE TABLE app_organization_persona (id INT NOT NULL, organization_id INT DEFAULT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
179
                $this->addSql('CREATE UNIQUE INDEX UNIQ_7767B60FD17F50A6 ON app_organization_persona (uuid)');
180
                $this->addSql('CREATE INDEX IDX_7767B60F32C8A3DE ON app_organization_persona (organization_id)');
181
                $this->addSql('COMMENT ON COLUMN app_organization_persona.data IS \'(DC2Type:json_array)\'');
182
                $this->addSql('CREATE TABLE app_organization_persona_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
183
                $this->addSql('CREATE INDEX IDX_63870C2F2C2AC5D3 ON app_organization_persona_trans (translatable_id)');
184
                $this->addSql('CREATE UNIQUE INDEX app_organization_persona_trans_unique_translation ON app_organization_persona_trans (translatable_id, locale)');
185
                $this->addSql('CREATE TABLE app_role (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, permissions JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
186
                $this->addSql('CREATE UNIQUE INDEX UNIQ_5247AFCAD17F50A6 ON app_role (uuid)');
187
                $this->addSql('CREATE UNIQUE INDEX UNIQ_5247AFCA989D9B624E59C462 ON app_role (slug, tenant)');
188
                $this->addSql('COMMENT ON COLUMN app_role.permissions IS \'(DC2Type:json_array)\'');
189
                $this->addSql('CREATE TABLE app_role_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
190
                $this->addSql('CREATE INDEX IDX_D1E65DEE2C2AC5D3 ON app_role_trans (translatable_id)');
191
                $this->addSql('CREATE UNIQUE INDEX app_role_trans_unique_translation ON app_role_trans (translatable_id, locale)');
192
                $this->addSql('CREATE TABLE app_staff (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
193
                $this->addSql('CREATE UNIQUE INDEX UNIQ_94BD7E5FD17F50A6 ON app_staff (uuid)');
194
                $this->addSql('CREATE TABLE app_staff_role (staff_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(staff_id, role_id))');
195
                $this->addSql('CREATE INDEX IDX_E3445799D4D57CD ON app_staff_role (staff_id)');
196
                $this->addSql('CREATE INDEX IDX_E3445799D60322AC ON app_staff_role (role_id)');
197
                $this->addSql('CREATE TABLE app_staff_bu (staff_id INT NOT NULL, bu_id INT NOT NULL, PRIMARY KEY(staff_id, bu_id))');
198
                $this->addSql('CREATE INDEX IDX_8C89CE59D4D57CD ON app_staff_bu (staff_id)');
199
                $this->addSql('CREATE INDEX IDX_8C89CE59E0319FBC ON app_staff_bu (bu_id)');
200
                $this->addSql('CREATE TABLE app_staff_persona (id INT NOT NULL, staff_id INT DEFAULT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
201
                $this->addSql('CREATE UNIQUE INDEX UNIQ_972E9C81D17F50A6 ON app_staff_persona (uuid)');
202
                $this->addSql('CREATE INDEX IDX_972E9C81D4D57CD ON app_staff_persona (staff_id)');
203
                $this->addSql('COMMENT ON COLUMN app_staff_persona.data IS \'(DC2Type:json_array)\'');
204
                $this->addSql('CREATE TABLE app_staff_persona_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
205
                $this->addSql('CREATE INDEX IDX_83B289352C2AC5D3 ON app_staff_persona_trans (translatable_id)');
206
                $this->addSql('CREATE UNIQUE INDEX app_staff_persona_trans_unique_translation ON app_staff_persona_trans (translatable_id, locale)');
207
                $this->addSql('CREATE TABLE app_system (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
208
                $this->addSql('CREATE UNIQUE INDEX UNIQ_2C4E7C0BD17F50A6 ON app_system (uuid)');
209
                $this->addSql('CREATE TABLE app_system_role (system_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(system_id, role_id))');
210
                $this->addSql('CREATE INDEX IDX_1F401F20D0952FA5 ON app_system_role (system_id)');
211
                $this->addSql('CREATE INDEX IDX_1F401F20D60322AC ON app_system_role (role_id)');
212
                $this->addSql('ALTER TABLE app_anonymous_role ADD CONSTRAINT FK_E2D1EAF6FA93803 FOREIGN KEY (anonymous_id) REFERENCES app_anonymous (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
213
                $this->addSql('ALTER TABLE app_anonymous_role ADD CONSTRAINT FK_E2D1EAF6D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
214
                $this->addSql('ALTER TABLE app_anonymous_persona ADD CONSTRAINT FK_5ABA7A3FA93803 FOREIGN KEY (anonymous_id) REFERENCES app_anonymous (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
215
                $this->addSql('ALTER TABLE app_anonymous_persona_trans ADD CONSTRAINT FK_3B378E082C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_anonymous_persona (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
216
                $this->addSql('ALTER TABLE app_bu_trans ADD CONSTRAINT FK_AE7B40C2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_bu (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
217
                $this->addSql('ALTER TABLE app_individual_role ADD CONSTRAINT FK_C5713550AE271C0D FOREIGN KEY (individual_id) REFERENCES app_individual (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
218
                $this->addSql('ALTER TABLE app_individual_role ADD CONSTRAINT FK_C5713550D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
219
                $this->addSql('ALTER TABLE app_individual_persona ADD CONSTRAINT FK_828FC6EAE271C0D FOREIGN KEY (individual_id) REFERENCES app_individual (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
220
                $this->addSql('ALTER TABLE app_individual_persona_trans ADD CONSTRAINT FK_2EB6F73E2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_individual_persona (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
221
                $this->addSql('ALTER TABLE app_organization_role ADD CONSTRAINT FK_CF25196832C8A3DE FOREIGN KEY (organization_id) REFERENCES app_organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
222
                $this->addSql('ALTER TABLE app_organization_role ADD CONSTRAINT FK_CF251968D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
223
                $this->addSql('ALTER TABLE app_organization_persona ADD CONSTRAINT FK_7767B60F32C8A3DE FOREIGN KEY (organization_id) REFERENCES app_organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
224
                $this->addSql('ALTER TABLE app_organization_persona_trans ADD CONSTRAINT FK_63870C2F2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_organization_persona (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
225
                $this->addSql('ALTER TABLE app_role_trans ADD CONSTRAINT FK_D1E65DEE2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_role (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
226
                $this->addSql('ALTER TABLE app_staff_role ADD CONSTRAINT FK_E3445799D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
227
                $this->addSql('ALTER TABLE app_staff_role ADD CONSTRAINT FK_E3445799D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
228
                $this->addSql('ALTER TABLE app_staff_bu ADD CONSTRAINT FK_8C89CE59D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
229
                $this->addSql('ALTER TABLE app_staff_bu ADD CONSTRAINT FK_8C89CE59E0319FBC FOREIGN KEY (bu_id) REFERENCES app_bu (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
230
                $this->addSql('ALTER TABLE app_staff_persona ADD CONSTRAINT FK_972E9C81D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
231
                $this->addSql('ALTER TABLE app_staff_persona_trans ADD CONSTRAINT FK_83B289352C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES app_staff_persona (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
232
                $this->addSql('ALTER TABLE app_system_role ADD CONSTRAINT FK_1F401F20D0952FA5 FOREIGN KEY (system_id) REFERENCES app_system (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
233
                $this->addSql('ALTER TABLE app_system_role ADD CONSTRAINT FK_1F401F20D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
234
235
                $i = 0;
236
                $j = 0;
237
238
                foreach ($businessUnits as $businessUnit) {
239
                    if (null === $businessUnit->uuid) {
240
                        $businessUnit->uuid = Uuid::uuid4()->toString();
241
                    }
242
243
                    $this->addSql(sprintf(
244
                        'INSERT INTO app_bu (id, uuid, owner, owner_uuid, version, tenant, created_at, updated_at, deleted_at) VALUES (%d, %s, %s, %s, %d, %s, %s, %s, %s);',
245
                        ++$i,
246
                        $this->connection->quote($businessUnit->uuid),
247
                        $this->connection->quote($businessUnit->owner),
248
                        $this->connection->quote($businessUnit->owner_uuid),
249
                        $businessUnit->version,
250
                        $this->connection->quote($businessUnit->tenant),
251
                        'now()',
252
                        'now()',
253
                        'NULL'
254
                    ));
255
256
                    foreach ($businessUnit->title as $locale => $title) {
257
                        $this->addSql(sprintf('INSERT INTO app_bu_trans (id, translatable_id, title, locale) VALUES (%d, %d, %s, %s);',
258
                            ++$j,
259
                            $i,
260
                            $this->connection->quote($title),
261
                            $this->connection->quote($locale)
262
                        ));
263
                    }
264
                }
265
266
                $i = 0;
267
                $j = 0;
268
269
                foreach ($roles as $role) {
270
                    if (null === $role->uuid) {
271
                        $role->uuid = Uuid::uuid4()->toString();
272
                    }
273
274
                    $this->addSql(sprintf(
275
                        'INSERT INTO app_role (id, uuid, owner, owner_uuid, slug, permissions, version, tenant, created_at, updated_at) VALUES (%d, %s, %s, %s, %s, %s, %d, %s, %s, %s);',
276
                        ++$i,
277
                        $this->connection->quote($role->uuid),
278
                        $this->connection->quote($role->owner),
279
                        $this->connection->quote($role->owner_uuid),
280
                        $this->connection->quote($role->slug),
281
                        $this->connection->quote(json_encode($role->permissions)),
282
                        $role->version,
283
                        $this->connection->quote($role->tenant),
284
                        'now()',
285
                        'now()'
286
                    ));
287
288
                    $ids['role'][$role->uuid] = $i;
289
290
                    foreach ($role->title as $locale => $title) {
291
                        $this->addSql(sprintf('INSERT INTO app_role_trans (id, translatable_id, title, locale) VALUES (%d, %d, %s, %s);',
292
                            ++$j,
293
                            $i,
294
                            $this->connection->quote($title),
295
                            $this->connection->quote($locale)
296
                        ));
297
                    }
298
                }
299
300
                $i = 0;
301
                $j = 0;
302
                $k = 0;
303
304
                foreach ($staffs as $staff) {
305
                    if (null === $staff->uuid) {
306
                        $staff->uuid = Uuid::uuid4()->toString();
307
                    }
308
309
                    $this->addSql(sprintf(
310
                        'INSERT INTO app_staff (id, uuid, owner, owner_uuid, version, tenant, created_at, updated_at, deleted_at) VALUES (%d, %s, %s, %s, %d, %s, %s, %s, %s);',
311
                        ++$i,
312
                        $this->connection->quote($staff->uuid),
313
                        $this->connection->quote($staff->owner),
314
                        $this->connection->quote($staff->owner_uuid),
315
                        $staff->version,
316
                        $this->connection->quote($staff->tenant),
317
                        'now()',
318
                        'now()',
319
                        'NULL'
320
                    ));
321
322
                    foreach ($staff->personas as $persona) {
323
                        if (null === $persona->uuid) {
324
                            $persona->uuid = Uuid::uuid4()->toString();
325
                        }
326
327
                        $this->addSql(sprintf(
328
                            'INSERT INTO app_staff_persona (id, staff_id, uuid, owner, owner_uuid, data, version, tenant, created_at, updated_at, deleted_at) VALUES (%d, %d, %s, %s, %s, %s, %d, %s, %s, %s, %s);',
329
                            ++$j,
330
                            $i,
331
                            $this->connection->quote($persona->uuid),
332
                            $this->connection->quote($staff->owner),
333
                            $this->connection->quote($staff->owner_uuid),
334
                            $this->connection->quote(json_encode($persona->data)),
335
                            $persona->version,
336
                            $this->connection->quote($staff->tenant),
337
                            'now()',
338
                            'now()',
339
                            'NULL'
340
                        ));
341
342
                        foreach ($persona->title as $locale => $title) {
343
                            $this->addSql(sprintf('INSERT INTO app_staff_persona_trans (id, translatable_id, title, locale) VALUES (%d, %d, %s, %s);',
344
                                ++$k,
345
                                $j,
346
                                $this->connection->quote($title),
347
                                $this->connection->quote($locale)
348
                            ));
349
                        }
350
                    }
351
352
                    foreach ($staff->roles as $role) {
353
                        $this->addSql(sprintf(
354
                            'INSERT INTO app_staff_role (staff_id, role_id) VALUES (%d, %d);',
355
                            $i,
356
                            $ids['role'][$role]
357
                        ));
358
                    }
359
                }
360
361
                $i = 0;
362
363
                foreach ($systems as $system) {
364
                    if (null === $system->uuid) {
365
                        $system->uuid = Uuid::uuid4()->toString();
366
                    }
367
368
                    $this->addSql(sprintf(
369
                        'INSERT INTO app_system (id, uuid, owner, owner_uuid, version, tenant, created_at, updated_at, deleted_at) VALUES (%d, %s, %s, %s, %d, %s, %s, %s, %s);',
370
                        ++$i,
371
                        $this->connection->quote($system->uuid),
372
                        $this->connection->quote($system->owner),
373
                        $this->connection->quote($system->owner_uuid),
374
                        $system->version,
375
                        $this->connection->quote($system->tenant),
376
                        'now()',
377
                        'now()',
378
                        'NULL'
379
                    ));
380
                }
381
382
                break;
383
384
            default:
385
                $this->abortIf(true,'Migration cannot be executed on "'.$this->platform->getName().'".');
386
                break;
387
        }
388
    }
389
390
    /**
391
     * Down migration
392
     *
393
     * @param \Doctrine\DBAL\Schema\Schema $schema
394
     */
395
    public function down(Schema $schema)
396
    {
397
        $this->acl->down($schema);
398
        $this->config->setContainer($this->container)->down($schema);
399
        $this->metadata->down($schema);
400
        $this->parameter->setContainer($this->container)->down($schema);
401
        $this->tenant->down($schema);
402
403
        switch ($this->platform->getName()) {
404
            case 'postgresql':
405
                $this->addSql('ALTER TABLE app_anonymous_role DROP CONSTRAINT FK_E2D1EAF6FA93803');
406
                $this->addSql('ALTER TABLE app_anonymous_persona DROP CONSTRAINT FK_5ABA7A3FA93803');
407
                $this->addSql('ALTER TABLE app_anonymous_persona_trans DROP CONSTRAINT FK_3B378E082C2AC5D3');
408
                $this->addSql('ALTER TABLE app_bu_trans DROP CONSTRAINT FK_AE7B40C2C2AC5D3');
409
                $this->addSql('ALTER TABLE app_staff_bu DROP CONSTRAINT FK_8C89CE59E0319FBC');
410
                $this->addSql('ALTER TABLE app_individual_role DROP CONSTRAINT FK_C5713550AE271C0D');
411
                $this->addSql('ALTER TABLE app_individual_persona DROP CONSTRAINT FK_828FC6EAE271C0D');
412
                $this->addSql('ALTER TABLE app_individual_persona_trans DROP CONSTRAINT FK_2EB6F73E2C2AC5D3');
413
                $this->addSql('ALTER TABLE app_organization_role DROP CONSTRAINT FK_CF25196832C8A3DE');
414
                $this->addSql('ALTER TABLE app_organization_persona DROP CONSTRAINT FK_7767B60F32C8A3DE');
415
                $this->addSql('ALTER TABLE app_organization_persona_trans DROP CONSTRAINT FK_63870C2F2C2AC5D3');
416
                $this->addSql('ALTER TABLE app_anonymous_role DROP CONSTRAINT FK_E2D1EAF6D60322AC');
417
                $this->addSql('ALTER TABLE app_individual_role DROP CONSTRAINT FK_C5713550D60322AC');
418
                $this->addSql('ALTER TABLE app_organization_role DROP CONSTRAINT FK_CF251968D60322AC');
419
                $this->addSql('ALTER TABLE app_role_trans DROP CONSTRAINT FK_D1E65DEE2C2AC5D3');
420
                $this->addSql('ALTER TABLE app_staff_role DROP CONSTRAINT FK_E3445799D60322AC');
421
                $this->addSql('ALTER TABLE app_system_role DROP CONSTRAINT FK_1F401F20D60322AC');
422
                $this->addSql('ALTER TABLE app_staff_role DROP CONSTRAINT FK_E3445799D4D57CD');
423
                $this->addSql('ALTER TABLE app_staff_bu DROP CONSTRAINT FK_8C89CE59D4D57CD');
424
                $this->addSql('ALTER TABLE app_staff_persona DROP CONSTRAINT FK_972E9C81D4D57CD');
425
                $this->addSql('ALTER TABLE app_staff_persona_trans DROP CONSTRAINT FK_83B289352C2AC5D3');
426
                $this->addSql('ALTER TABLE app_system_role DROP CONSTRAINT FK_1F401F20D0952FA5');
427
                $this->addSql('DROP SEQUENCE app_anonymous_id_seq CASCADE');
428
                $this->addSql('DROP SEQUENCE app_anonymous_persona_id_seq CASCADE');
429
                $this->addSql('DROP SEQUENCE app_anonymous_persona_trans_id_seq CASCADE');
430
                $this->addSql('DROP SEQUENCE app_bu_id_seq CASCADE');
431
                $this->addSql('DROP SEQUENCE app_bu_trans_id_seq CASCADE');
432
                $this->addSql('DROP SEQUENCE app_individual_id_seq CASCADE');
433
                $this->addSql('DROP SEQUENCE app_individual_persona_id_seq CASCADE');
434
                $this->addSql('DROP SEQUENCE app_individual_persona_trans_id_seq CASCADE');
435
                $this->addSql('DROP SEQUENCE app_organization_id_seq CASCADE');
436
                $this->addSql('DROP SEQUENCE app_organization_persona_id_seq CASCADE');
437
                $this->addSql('DROP SEQUENCE app_organization_persona_trans_id_seq CASCADE');
438
                $this->addSql('DROP SEQUENCE app_role_id_seq CASCADE');
439
                $this->addSql('DROP SEQUENCE app_role_trans_id_seq CASCADE');
440
                $this->addSql('DROP SEQUENCE app_staff_id_seq CASCADE');
441
                $this->addSql('DROP SEQUENCE app_staff_persona_id_seq CASCADE');
442
                $this->addSql('DROP SEQUENCE app_staff_persona_trans_id_seq CASCADE');
443
                $this->addSql('DROP SEQUENCE app_system_id_seq CASCADE');
444
                $this->addSql('DROP TABLE app_anonymous');
445
                $this->addSql('DROP TABLE app_anonymous_role');
446
                $this->addSql('DROP TABLE app_anonymous_persona');
447
                $this->addSql('DROP TABLE app_anonymous_persona_trans');
448
                $this->addSql('DROP TABLE app_bu');
449
                $this->addSql('DROP TABLE app_bu_trans');
450
                $this->addSql('DROP TABLE app_individual');
451
                $this->addSql('DROP TABLE app_individual_role');
452
                $this->addSql('DROP TABLE app_individual_persona');
453
                $this->addSql('DROP TABLE app_individual_persona_trans');
454
                $this->addSql('DROP TABLE app_organization');
455
                $this->addSql('DROP TABLE app_organization_role');
456
                $this->addSql('DROP TABLE app_organization_persona');
457
                $this->addSql('DROP TABLE app_organization_persona_trans');
458
                $this->addSql('DROP TABLE app_role');
459
                $this->addSql('DROP TABLE app_role_trans');
460
                $this->addSql('DROP TABLE app_staff');
461
                $this->addSql('DROP TABLE app_staff_role');
462
                $this->addSql('DROP TABLE app_staff_bu');
463
                $this->addSql('DROP TABLE app_staff_persona');
464
                $this->addSql('DROP TABLE app_staff_persona_trans');
465
                $this->addSql('DROP TABLE app_system');
466
                $this->addSql('DROP TABLE app_system_role');
467
                break;
468
469
            default:
470
                $this->abortIf(true,'Migration cannot be executed on "'.$this->platform->getName().'".');
471
                break;
472
        }
473
    }
474
}
475