| Conditions | 13 | 
| Paths | 577 | 
| Total Lines | 444 | 
| Code Lines | 327 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 25 | public function up(Schema $schema)  | 
            ||
| 26 |     { | 
            ||
| 27 | $platform = $this->connection->getDatabasePlatform()->getName();  | 
            ||
| 28 |         $cipherService = $this->container->get('ds_encryption.service.cipher'); | 
            ||
| 29 | |||
| 30 |         switch ($platform) { | 
            ||
| 31 | case 'postgresql':  | 
            ||
| 32 | // Schema  | 
            ||
| 33 |                 $this->addSql('CREATE SEQUENCE ds_config_id_seq INCREMENT BY 1 MINVALUE 1 START 9'); | 
            ||
| 34 |                 $this->addSql('CREATE SEQUENCE ds_parameter_id_seq INCREMENT BY 1 MINVALUE 1 START 4'); | 
            ||
| 35 |                 $this->addSql('CREATE SEQUENCE ds_metadata_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 36 |                 $this->addSql('CREATE SEQUENCE ds_metadata_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 37 |                 $this->addSql('CREATE SEQUENCE ds_access_id_seq INCREMENT BY 1 MINVALUE 1 START 3'); | 
            ||
| 38 |                 $this->addSql('CREATE SEQUENCE ds_access_permission_id_seq INCREMENT BY 1 MINVALUE 1 START 7'); | 
            ||
| 39 |                 $this->addSql('CREATE SEQUENCE ds_tenant_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 40 |                 $this->addSql('CREATE SEQUENCE app_anonymous_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 41 |                 $this->addSql('CREATE SEQUENCE app_anonymous_persona_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 42 |                 $this->addSql('CREATE SEQUENCE app_anonymous_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 43 |                 $this->addSql('CREATE SEQUENCE app_bu_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 44 |                 $this->addSql('CREATE SEQUENCE app_bu_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 45 |                 $this->addSql('CREATE SEQUENCE app_individual_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 46 |                 $this->addSql('CREATE SEQUENCE app_individual_persona_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 47 |                 $this->addSql('CREATE SEQUENCE app_individual_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 48 |                 $this->addSql('CREATE SEQUENCE app_organization_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 49 |                 $this->addSql('CREATE SEQUENCE app_organization_persona_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 50 |                 $this->addSql('CREATE SEQUENCE app_organization_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 51 |                 $this->addSql('CREATE SEQUENCE app_role_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 52 |                 $this->addSql('CREATE SEQUENCE app_role_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | 
            ||
| 53 |                 $this->addSql('CREATE SEQUENCE app_staff_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 54 |                 $this->addSql('CREATE SEQUENCE app_staff_persona_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 55 |                 $this->addSql('CREATE SEQUENCE app_staff_persona_trans_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 56 |                 $this->addSql('CREATE SEQUENCE app_system_id_seq INCREMENT BY 1 MINVALUE 1 START 2'); | 
            ||
| 57 |                 $this->addSql('CREATE TABLE ds_config (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, "key" VARCHAR(255) NOT NULL, value TEXT DEFAULT 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))'); | 
            ||
| 58 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_758C45F4D17F50A6 ON ds_config (uuid)'); | 
            ||
| 59 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_758C45F48A90ABA94E59C462 ON ds_config (key, tenant)'); | 
            ||
| 60 |                 $this->addSql('CREATE TABLE ds_parameter (id INT NOT NULL, "key" VARCHAR(255) NOT NULL, value TEXT DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 61 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_B3C0FD91F48571EB ON ds_parameter ("key")'); | 
            ||
| 62 |                 $this->addSql('CREATE TABLE ds_metadata (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, slug VARCHAR(255) NOT NULL, type VARCHAR(255) 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))'); | 
            ||
| 63 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11290F17D17F50A6 ON ds_metadata (uuid)'); | 
            ||
| 64 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_11290F17989D9B624E59C462 ON ds_metadata (slug, tenant)'); | 
            ||
| 65 |                 $this->addSql('CREATE TABLE ds_metadata_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 66 |                 $this->addSql('CREATE INDEX IDX_A6447E202C2AC5D3 ON ds_metadata_trans (translatable_id)'); | 
            ||
| 67 |                 $this->addSql('CREATE UNIQUE INDEX ds_metadata_trans_unique_translation ON ds_metadata_trans (translatable_id, locale)'); | 
            ||
| 68 |                 $this->addSql('CREATE TABLE ds_access (id INT NOT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, assignee VARCHAR(255) DEFAULT NULL, assignee_uuid UUID DEFAULT 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))'); | 
            ||
| 69 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_A76F41DCD17F50A6 ON ds_access (uuid)'); | 
            ||
| 70 |                 $this->addSql('CREATE TABLE ds_access_permission (id INT NOT NULL, access_id INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, entity VARCHAR(255) DEFAULT NULL, entity_uuid UUID DEFAULT NULL, "key" VARCHAR(255) NOT NULL, attributes JSON NOT NULL, tenant UUID NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 71 |                 $this->addSql('CREATE INDEX IDX_D46DD4D04FEA67CF ON ds_access_permission (access_id)'); | 
            ||
| 72 |                 $this->addSql('CREATE TABLE ds_tenant (id INT NOT NULL, uuid UUID NOT NULL, data JSON NOT NULL, version INT DEFAULT 1 NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | 
            ||
| 73 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_EF5FAEEAD17F50A6 ON ds_tenant (uuid)'); | 
            ||
| 74 |                 $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))'); | 
            ||
| 75 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_6A5EB29BD17F50A6 ON app_anonymous (uuid)'); | 
            ||
| 76 |                 $this->addSql('CREATE TABLE app_anonymous_role (anonymous_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(anonymous_id, role_id))'); | 
            ||
| 77 |                 $this->addSql('CREATE INDEX IDX_E2D1EAF6FA93803 ON app_anonymous_role (anonymous_id)'); | 
            ||
| 78 |                 $this->addSql('CREATE INDEX IDX_E2D1EAF6D60322AC ON app_anonymous_role (role_id)'); | 
            ||
| 79 |                 $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))'); | 
            ||
| 80 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_5ABA7A3D17F50A6 ON app_anonymous_persona (uuid)'); | 
            ||
| 81 |                 $this->addSql('CREATE INDEX IDX_5ABA7A3FA93803 ON app_anonymous_persona (anonymous_id)'); | 
            ||
| 82 |                 $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))'); | 
            ||
| 83 |                 $this->addSql('CREATE INDEX IDX_3B378E082C2AC5D3 ON app_anonymous_persona_trans (translatable_id)'); | 
            ||
| 84 |                 $this->addSql('CREATE UNIQUE INDEX app_anonymous_persona_trans_unique_translation ON app_anonymous_persona_trans (translatable_id, locale)'); | 
            ||
| 85 |                 $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))'); | 
            ||
| 86 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_F0C3D814D17F50A6 ON app_bu (uuid)'); | 
            ||
| 87 |                 $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))'); | 
            ||
| 88 |                 $this->addSql('CREATE INDEX IDX_AE7B40C2C2AC5D3 ON app_bu_trans (translatable_id)'); | 
            ||
| 89 |                 $this->addSql('CREATE UNIQUE INDEX app_bu_trans_unique_translation ON app_bu_trans (translatable_id, locale)'); | 
            ||
| 90 |                 $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))'); | 
            ||
| 91 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_D188576BD17F50A6 ON app_individual (uuid)'); | 
            ||
| 92 |                 $this->addSql('CREATE TABLE app_individual_role (individual_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(individual_id, role_id))'); | 
            ||
| 93 |                 $this->addSql('CREATE INDEX IDX_C5713550AE271C0D ON app_individual_role (individual_id)'); | 
            ||
| 94 |                 $this->addSql('CREATE INDEX IDX_C5713550D60322AC ON app_individual_role (role_id)'); | 
            ||
| 95 |                 $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))'); | 
            ||
| 96 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_828FC6ED17F50A6 ON app_individual_persona (uuid)'); | 
            ||
| 97 |                 $this->addSql('CREATE INDEX IDX_828FC6EAE271C0D ON app_individual_persona (individual_id)'); | 
            ||
| 98 |                 $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))'); | 
            ||
| 99 |                 $this->addSql('CREATE INDEX IDX_2EB6F73E2C2AC5D3 ON app_individual_persona_trans (translatable_id)'); | 
            ||
| 100 |                 $this->addSql('CREATE UNIQUE INDEX app_individual_persona_trans_unique_translation ON app_individual_persona_trans (translatable_id, locale)'); | 
            ||
| 101 |                 $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))'); | 
            ||
| 102 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_36079FDD17F50A6 ON app_organization (uuid)'); | 
            ||
| 103 |                 $this->addSql('CREATE TABLE app_organization_role (organization_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(organization_id, role_id))'); | 
            ||
| 104 |                 $this->addSql('CREATE INDEX IDX_CF25196832C8A3DE ON app_organization_role (organization_id)'); | 
            ||
| 105 |                 $this->addSql('CREATE INDEX IDX_CF251968D60322AC ON app_organization_role (role_id)'); | 
            ||
| 106 |                 $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))'); | 
            ||
| 107 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_7767B60FD17F50A6 ON app_organization_persona (uuid)'); | 
            ||
| 108 |                 $this->addSql('CREATE INDEX IDX_7767B60F32C8A3DE ON app_organization_persona (organization_id)'); | 
            ||
| 109 |                 $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))'); | 
            ||
| 110 |                 $this->addSql('CREATE INDEX IDX_63870C2F2C2AC5D3 ON app_organization_persona_trans (translatable_id)'); | 
            ||
| 111 |                 $this->addSql('CREATE UNIQUE INDEX app_organization_persona_trans_unique_translation ON app_organization_persona_trans (translatable_id, locale)'); | 
            ||
| 112 |                 $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, 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))'); | 
            ||
| 113 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_5247AFCAD17F50A6 ON app_role (uuid)'); | 
            ||
| 114 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_5247AFCA989D9B624E59C462 ON app_role (slug, tenant)'); | 
            ||
| 115 |                 $this->addSql('CREATE TABLE app_role_trans (id INT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, locale VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | 
            ||
| 116 |                 $this->addSql('CREATE INDEX IDX_D1E65DEE2C2AC5D3 ON app_role_trans (translatable_id)'); | 
            ||
| 117 |                 $this->addSql('CREATE UNIQUE INDEX app_role_trans_unique_translation ON app_role_trans (translatable_id, locale)'); | 
            ||
| 118 |                 $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))'); | 
            ||
| 119 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_94BD7E5FD17F50A6 ON app_staff (uuid)'); | 
            ||
| 120 |                 $this->addSql('CREATE TABLE app_staff_role (staff_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(staff_id, role_id))'); | 
            ||
| 121 |                 $this->addSql('CREATE INDEX IDX_E3445799D4D57CD ON app_staff_role (staff_id)'); | 
            ||
| 122 |                 $this->addSql('CREATE INDEX IDX_E3445799D60322AC ON app_staff_role (role_id)'); | 
            ||
| 123 |                 $this->addSql('CREATE TABLE app_staff_bu (staff_id INT NOT NULL, bu_id INT NOT NULL, PRIMARY KEY(staff_id, bu_id))'); | 
            ||
| 124 |                 $this->addSql('CREATE INDEX IDX_8C89CE59D4D57CD ON app_staff_bu (staff_id)'); | 
            ||
| 125 |                 $this->addSql('CREATE INDEX IDX_8C89CE59E0319FBC ON app_staff_bu (bu_id)'); | 
            ||
| 126 |                 $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))'); | 
            ||
| 127 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_972E9C81D17F50A6 ON app_staff_persona (uuid)'); | 
            ||
| 128 |                 $this->addSql('CREATE INDEX IDX_972E9C81D4D57CD ON app_staff_persona (staff_id)'); | 
            ||
| 129 |                 $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))'); | 
            ||
| 130 |                 $this->addSql('CREATE INDEX IDX_83B289352C2AC5D3 ON app_staff_persona_trans (translatable_id)'); | 
            ||
| 131 |                 $this->addSql('CREATE UNIQUE INDEX app_staff_persona_trans_unique_translation ON app_staff_persona_trans (translatable_id, locale)'); | 
            ||
| 132 |                 $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))'); | 
            ||
| 133 |                 $this->addSql('CREATE UNIQUE INDEX UNIQ_2C4E7C0BD17F50A6 ON app_system (uuid)'); | 
            ||
| 134 |                 $this->addSql('CREATE TABLE app_system_role (system_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY(system_id, role_id))'); | 
            ||
| 135 |                 $this->addSql('CREATE INDEX IDX_1F401F20D0952FA5 ON app_system_role (system_id)'); | 
            ||
| 136 |                 $this->addSql('CREATE INDEX IDX_1F401F20D60322AC ON app_system_role (role_id)'); | 
            ||
| 137 |                 $this->addSql('ALTER TABLE ds_metadata_trans ADD CONSTRAINT FK_A6447E202C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES ds_metadata (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 138 |                 $this->addSql('ALTER TABLE ds_access_permission ADD CONSTRAINT FK_D46DD4D04FEA67CF FOREIGN KEY (access_id) REFERENCES ds_access (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 139 |                 $this->addSql('ALTER TABLE app_anonymous_role ADD CONSTRAINT FK_E2D1EAF6FA93803 FOREIGN KEY (anonymous_id) REFERENCES app_anonymous (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 140 |                 $this->addSql('ALTER TABLE app_anonymous_role ADD CONSTRAINT FK_E2D1EAF6D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 141 |                 $this->addSql('ALTER TABLE app_anonymous_persona ADD CONSTRAINT FK_5ABA7A3FA93803 FOREIGN KEY (anonymous_id) REFERENCES app_anonymous (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 142 |                 $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'); | 
            ||
| 143 |                 $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'); | 
            ||
| 144 |                 $this->addSql('ALTER TABLE app_individual_role ADD CONSTRAINT FK_C5713550AE271C0D FOREIGN KEY (individual_id) REFERENCES app_individual (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 145 |                 $this->addSql('ALTER TABLE app_individual_role ADD CONSTRAINT FK_C5713550D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 146 |                 $this->addSql('ALTER TABLE app_individual_persona ADD CONSTRAINT FK_828FC6EAE271C0D FOREIGN KEY (individual_id) REFERENCES app_individual (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 147 |                 $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'); | 
            ||
| 148 |                 $this->addSql('ALTER TABLE app_organization_role ADD CONSTRAINT FK_CF25196832C8A3DE FOREIGN KEY (organization_id) REFERENCES app_organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 149 |                 $this->addSql('ALTER TABLE app_organization_role ADD CONSTRAINT FK_CF251968D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 150 |                 $this->addSql('ALTER TABLE app_organization_persona ADD CONSTRAINT FK_7767B60F32C8A3DE FOREIGN KEY (organization_id) REFERENCES app_organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 151 |                 $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'); | 
            ||
| 152 |                 $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'); | 
            ||
| 153 |                 $this->addSql('ALTER TABLE app_staff_role ADD CONSTRAINT FK_E3445799D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 154 |                 $this->addSql('ALTER TABLE app_staff_role ADD CONSTRAINT FK_E3445799D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 155 |                 $this->addSql('ALTER TABLE app_staff_bu ADD CONSTRAINT FK_8C89CE59D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 156 |                 $this->addSql('ALTER TABLE app_staff_bu ADD CONSTRAINT FK_8C89CE59E0319FBC FOREIGN KEY (bu_id) REFERENCES app_bu (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 157 |                 $this->addSql('ALTER TABLE app_staff_persona ADD CONSTRAINT FK_972E9C81D4D57CD FOREIGN KEY (staff_id) REFERENCES app_staff (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 158 |                 $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'); | 
            ||
| 159 |                 $this->addSql('ALTER TABLE app_system_role ADD CONSTRAINT FK_1F401F20D0952FA5 FOREIGN KEY (system_id) REFERENCES app_system (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 160 |                 $this->addSql('ALTER TABLE app_system_role ADD CONSTRAINT FK_1F401F20D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | 
            ||
| 161 |                 $this->addSql('CREATE TABLE ds_session (id VARCHAR(128) NOT NULL PRIMARY KEY, data BYTEA NOT NULL, time INTEGER NOT NULL, lifetime INTEGER NOT NULL)'); | 
            ||
| 162 | |||
| 163 | // Data  | 
            ||
| 164 |                 $yml = file_get_contents('/srv/api-platform/src/AppBundle/Resources/migrations/1_0_0.yml'); | 
            ||
| 165 | $data = Yaml::parse($yml);  | 
            ||
| 166 | $i = 0;  | 
            ||
| 167 | $parameters = [  | 
            ||
| 168 | [  | 
            ||
| 169 | 'key' => 'ds_system.user.username',  | 
            ||
| 170 | 'value' => serialize($data['system']['username'])  | 
            ||
| 171 | ],  | 
            ||
| 172 | [  | 
            ||
| 173 | 'key' => 'ds_system.user.password',  | 
            ||
| 174 | 'value' => $cipherService->encrypt($data['system']['password'])  | 
            ||
| 175 | ],  | 
            ||
| 176 | [  | 
            ||
| 177 | 'key' => 'ds_tenant.tenant.default',  | 
            ||
| 178 | 'value' => serialize($data['tenant']['uuid'])  | 
            ||
| 179 | ]  | 
            ||
| 180 | ];  | 
            ||
| 181 | |||
| 182 |                 foreach ($parameters as $parameter) { | 
            ||
| 183 | $this->addSql(sprintf(  | 
            ||
| 184 | 'INSERT INTO ds_parameter (id, key, value) VALUES (%d, %s, %s);',  | 
            ||
| 185 | ++$i,  | 
            ||
| 186 | $this->connection->quote($parameter['key']),  | 
            ||
| 187 | $this->connection->quote($parameter['value'])  | 
            ||
| 188 | ));  | 
            ||
| 189 | }  | 
            ||
| 190 | |||
| 191 | $i = 0;  | 
            ||
| 192 | $tenants = [  | 
            ||
| 193 | [  | 
            ||
| 194 | 'uuid' => $data['tenant']['uuid'],  | 
            ||
| 195 | 'data' => '"'.$cipherService->encrypt(new stdClass).'"'  | 
            ||
| 196 | ]  | 
            ||
| 197 | ];  | 
            ||
| 198 | |||
| 199 |                 foreach ($tenants as $tenant) { | 
            ||
| 200 | $this->addSql(sprintf(  | 
            ||
| 201 | 'INSERT INTO ds_tenant (id, uuid, data, created_at, updated_at) VALUES (%d, %s, %s, %s, %s);',  | 
            ||
| 202 | ++$i,  | 
            ||
| 203 | $this->connection->quote($tenant['uuid']),  | 
            ||
| 204 | $this->connection->quote($tenant['data']),  | 
            ||
| 205 | 'now()',  | 
            ||
| 206 | 'now()'  | 
            ||
| 207 | ));  | 
            ||
| 208 | }  | 
            ||
| 209 | |||
| 210 | $i = 0;  | 
            ||
| 211 | $configs = [  | 
            ||
| 212 | [  | 
            ||
| 213 | 'key' => 'ds_api.user.username',  | 
            ||
| 214 | 'value' => serialize($data['user']['system']['username'])  | 
            ||
| 215 | ],  | 
            ||
| 216 | [  | 
            ||
| 217 | 'key' => 'ds_api.user.password',  | 
            ||
| 218 | 'value' => $cipherService->encrypt($data['user']['system']['password'])  | 
            ||
| 219 | ],  | 
            ||
| 220 | [  | 
            ||
| 221 | 'key' => 'ds_api.user.uuid',  | 
            ||
| 222 | 'value' => serialize($data['user']['system']['uuid'])  | 
            ||
| 223 | ],  | 
            ||
| 224 | [  | 
            ||
| 225 | 'key' => 'ds_api.user.roles',  | 
            ||
| 226 | 'value' => serialize([])  | 
            ||
| 227 | ],  | 
            ||
| 228 | [  | 
            ||
| 229 | 'key' => 'ds_api.user.identity.roles',  | 
            ||
| 230 | 'value' => serialize([])  | 
            ||
| 231 | ],  | 
            ||
| 232 | [  | 
            ||
| 233 | 'key' => 'ds_api.user.identity.type',  | 
            ||
| 234 |                         'value' => serialize('System') | 
            ||
| 235 | ],  | 
            ||
| 236 | [  | 
            ||
| 237 | 'key' => 'ds_api.user.identity.uuid',  | 
            ||
| 238 | 'value' => serialize($data['identity']['system']['uuid'])  | 
            ||
| 239 | ],  | 
            ||
| 240 | [  | 
            ||
| 241 | 'key' => 'ds_api.user.tenant',  | 
            ||
| 242 | 'value' => serialize($data['tenant']['uuid'])  | 
            ||
| 243 | ]  | 
            ||
| 244 | ];  | 
            ||
| 245 | |||
| 246 |                 foreach ($configs as $config) { | 
            ||
| 247 | $this->addSql(sprintf(  | 
            ||
| 248 | 'INSERT INTO ds_config (id, uuid, owner, owner_uuid, key, value, version, tenant, created_at, updated_at) VALUES (%d, %s, %s, %s, %s, %s, %d, %s, %s, %s);',  | 
            ||
| 249 | ++$i,  | 
            ||
| 250 | $this->connection->quote(Uuid::uuid4()->toString()),  | 
            ||
| 251 |                         $this->connection->quote('BusinessUnit'), | 
            ||
| 252 | $this->connection->quote($data['business_unit']['administration']['uuid']),  | 
            ||
| 253 | $this->connection->quote($config['key']),  | 
            ||
| 254 | $this->connection->quote($config['value']),  | 
            ||
| 255 | 1,  | 
            ||
| 256 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 257 | 'now()',  | 
            ||
| 258 | 'now()'  | 
            ||
| 259 | ));  | 
            ||
| 260 | }  | 
            ||
| 261 | |||
| 262 | $i = 0;  | 
            ||
| 263 | $j = 0;  | 
            ||
| 264 | $accesses = [  | 
            ||
| 265 | [  | 
            ||
| 266 | 'owner' => 'System',  | 
            ||
| 267 | 'owner_uuid' => $data['identity']['system']['uuid'],  | 
            ||
| 268 | 'assignee' => 'System',  | 
            ||
| 269 | 'assignee_uuid' => $data['identity']['system']['uuid'],  | 
            ||
| 270 | 'permissions' => [  | 
            ||
| 271 | [  | 
            ||
| 272 | 'key' => 'entity',  | 
            ||
| 273 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE"]'  | 
            ||
| 274 | ],  | 
            ||
| 275 | [  | 
            ||
| 276 | 'key' => 'property',  | 
            ||
| 277 | 'attributes' => '["BROWSE","READ","EDIT"]'  | 
            ||
| 278 | ],  | 
            ||
| 279 | [  | 
            ||
| 280 | 'key' => 'generic',  | 
            ||
| 281 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE","EXECUTE"]'  | 
            ||
| 282 | ]  | 
            ||
| 283 | ]  | 
            ||
| 284 | ],  | 
            ||
| 285 | [  | 
            ||
| 286 | 'owner' => 'BusinessUnit',  | 
            ||
| 287 | 'owner_uuid' => $data['business_unit']['administration']['uuid'],  | 
            ||
| 288 | 'assignee' => 'Staff',  | 
            ||
| 289 | 'assignee_uuid' => $data['identity']['admin']['uuid'],  | 
            ||
| 290 | 'permissions' => [  | 
            ||
| 291 | [  | 
            ||
| 292 | 'key' => 'entity',  | 
            ||
| 293 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE"]'  | 
            ||
| 294 | ],  | 
            ||
| 295 | [  | 
            ||
| 296 | 'key' => 'property',  | 
            ||
| 297 | 'attributes' => '["BROWSE","READ","EDIT"]'  | 
            ||
| 298 | ],  | 
            ||
| 299 | [  | 
            ||
| 300 | 'key' => 'generic',  | 
            ||
| 301 | 'attributes' => '["BROWSE","READ","EDIT","ADD","DELETE","EXECUTE"]'  | 
            ||
| 302 | ]  | 
            ||
| 303 | ]  | 
            ||
| 304 | ]  | 
            ||
| 305 | ];  | 
            ||
| 306 | |||
| 307 |                 foreach ($accesses as $access) { | 
            ||
| 308 | $this->addSql(sprintf(  | 
            ||
| 309 | 'INSERT INTO ds_access (id, uuid, owner, owner_uuid, assignee, assignee_uuid, version, tenant, created_at, updated_at) VALUES (%d, %s, %s, %s, %s, %s, %d, %s, %s, %s);',  | 
            ||
| 310 | ++$i,  | 
            ||
| 311 | $this->connection->quote(Uuid::uuid4()->toString()),  | 
            ||
| 312 | $this->connection->quote($access['owner']),  | 
            ||
| 313 | $this->connection->quote($access['owner_uuid']),  | 
            ||
| 314 | $this->connection->quote($access['assignee']),  | 
            ||
| 315 | $this->connection->quote($access['assignee_uuid']),  | 
            ||
| 316 | 1,  | 
            ||
| 317 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 318 | 'now()',  | 
            ||
| 319 | 'now()'  | 
            ||
| 320 | ));  | 
            ||
| 321 | |||
| 322 |                     foreach ($access['permissions'] as $permission) { | 
            ||
| 323 | $this->addSql(sprintf(  | 
            ||
| 324 | 'INSERT INTO ds_access_permission (id, access_id, scope, entity, entity_uuid, key, attributes, tenant) VALUES (%d, %d, %s, %s, %s, %s, %s, %s);',  | 
            ||
| 325 | ++$j,  | 
            ||
| 326 | $i,  | 
            ||
| 327 |                             $this->connection->quote('generic'), | 
            ||
| 328 | 'NULL',  | 
            ||
| 329 | 'NULL',  | 
            ||
| 330 | $this->connection->quote($permission['key']),  | 
            ||
| 331 | $this->connection->quote($permission['attributes']),  | 
            ||
| 332 | $this->connection->quote($data['tenant']['uuid'])  | 
            ||
| 333 | ));  | 
            ||
| 334 | }  | 
            ||
| 335 | }  | 
            ||
| 336 | |||
| 337 | $i = 0;  | 
            ||
| 338 | $j = 0;  | 
            ||
| 339 | $businessUnits = [  | 
            ||
| 340 | [  | 
            ||
| 341 | 'uuid' => $data['business_unit']['administration']['uuid'],  | 
            ||
| 342 | 'owner' => 'BusinessUnit',  | 
            ||
| 343 | 'owner_uuid' => $data['business_unit']['administration']['uuid'],  | 
            ||
| 344 | 'translations' => [  | 
            ||
| 345 | [  | 
            ||
| 346 | 'title' => 'Administration',  | 
            ||
| 347 | 'locale' => 'en'  | 
            ||
| 348 | ]  | 
            ||
| 349 | ]  | 
            ||
| 350 | ]  | 
            ||
| 351 | ];  | 
            ||
| 352 | |||
| 353 |                 foreach ($businessUnits as $businessUnit) { | 
            ||
| 354 | $this->addSql(sprintf(  | 
            ||
| 355 | '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);',  | 
            ||
| 356 | ++$i,  | 
            ||
| 357 | $this->connection->quote($businessUnit['uuid']),  | 
            ||
| 358 | $this->connection->quote($businessUnit['owner']),  | 
            ||
| 359 | $this->connection->quote($businessUnit['owner_uuid']),  | 
            ||
| 360 | 1,  | 
            ||
| 361 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 362 | 'now()',  | 
            ||
| 363 | 'now()',  | 
            ||
| 364 | 'NULL'  | 
            ||
| 365 | ));  | 
            ||
| 366 | |||
| 367 |                     foreach ($businessUnit['translations'] as $translation) { | 
            ||
| 368 |                         $this->addSql(sprintf('INSERT INTO app_bu_trans (id, translatable_id, title, locale) VALUES (%d, %d, %s, %s);', | 
            ||
| 369 | ++$j,  | 
            ||
| 370 | $i,  | 
            ||
| 371 | $this->connection->quote($translation['title']),  | 
            ||
| 372 | $this->connection->quote($translation['locale'])  | 
            ||
| 373 | ));  | 
            ||
| 374 | }  | 
            ||
| 375 | }  | 
            ||
| 376 | |||
| 377 | $i = 0;  | 
            ||
| 378 | $systems = [  | 
            ||
| 379 | [  | 
            ||
| 380 | 'uuid' => $data['identity']['system']['uuid'],  | 
            ||
| 381 | 'owner' => 'System',  | 
            ||
| 382 | 'owner_uuid' => $data['identity']['system']['uuid']  | 
            ||
| 383 | ]  | 
            ||
| 384 | ];  | 
            ||
| 385 | |||
| 386 |                 foreach ($systems as $system) { | 
            ||
| 387 | $this->addSql(sprintf(  | 
            ||
| 388 | '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);',  | 
            ||
| 389 | ++$i,  | 
            ||
| 390 | $this->connection->quote($system['uuid']),  | 
            ||
| 391 | $this->connection->quote($system['owner']),  | 
            ||
| 392 | $this->connection->quote($system['owner_uuid']),  | 
            ||
| 393 | 1,  | 
            ||
| 394 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 395 | 'now()',  | 
            ||
| 396 | 'now()',  | 
            ||
| 397 | 'NULL'  | 
            ||
| 398 | ));  | 
            ||
| 399 | }  | 
            ||
| 400 | |||
| 401 | $i = 0;  | 
            ||
| 402 | $j = 0;  | 
            ||
| 403 | $k = 0;  | 
            ||
| 404 | $staffs = [  | 
            ||
| 405 | [  | 
            ||
| 406 | 'uuid' => $data['identity']['admin']['uuid'],  | 
            ||
| 407 | 'owner' => 'BusinessUnit',  | 
            ||
| 408 | 'owner_uuid' => $data['business_unit']['administration']['uuid'],  | 
            ||
| 409 | 'personas' => [  | 
            ||
| 410 | [  | 
            ||
| 411 |                                 'data' => '{}', | 
            ||
| 412 | 'translations' => [  | 
            ||
| 413 | [  | 
            ||
| 414 | 'title' => 'Default',  | 
            ||
| 415 | 'locale' => 'en'  | 
            ||
| 416 | ]  | 
            ||
| 417 | ]  | 
            ||
| 418 | ]  | 
            ||
| 419 | ]  | 
            ||
| 420 | ]  | 
            ||
| 421 | ];  | 
            ||
| 422 | |||
| 423 |                 foreach ($staffs as $staff) { | 
            ||
| 424 | $this->addSql(sprintf(  | 
            ||
| 425 | '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);',  | 
            ||
| 426 | ++$i,  | 
            ||
| 427 | $this->connection->quote($staff['uuid']),  | 
            ||
| 428 | $this->connection->quote($staff['owner']),  | 
            ||
| 429 | $this->connection->quote($staff['owner_uuid']),  | 
            ||
| 430 | 1,  | 
            ||
| 431 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 432 | 'now()',  | 
            ||
| 433 | 'now()',  | 
            ||
| 434 | 'NULL'  | 
            ||
| 435 | ));  | 
            ||
| 436 | |||
| 437 |                     foreach ($staff['personas'] as $persona) { | 
            ||
| 438 | $this->addSql(sprintf(  | 
            ||
| 439 | '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);',  | 
            ||
| 440 | ++$j,  | 
            ||
| 441 | $i,  | 
            ||
| 442 | $this->connection->quote(Uuid::uuid4()->toString()),  | 
            ||
| 443 | $this->connection->quote($staff['owner']),  | 
            ||
| 444 | $this->connection->quote($staff['owner_uuid']),  | 
            ||
| 445 | $this->connection->quote($persona['data']),  | 
            ||
| 446 | 1,  | 
            ||
| 447 | $this->connection->quote($data['tenant']['uuid']),  | 
            ||
| 448 | 'now()',  | 
            ||
| 449 | 'now()',  | 
            ||
| 450 | 'NULL'  | 
            ||
| 451 | ));  | 
            ||
| 452 | |||
| 453 |                         foreach ($persona['translations'] as $translation) { | 
            ||
| 454 |                             $this->addSql(sprintf('INSERT INTO app_staff_persona_trans (id, translatable_id, title, locale) VALUES (%d, %d, %s, %s);', | 
            ||
| 455 | ++$k,  | 
            ||
| 456 | $j,  | 
            ||
| 457 | $this->connection->quote($translation['title']),  | 
            ||
| 458 | $this->connection->quote($translation['locale'])  | 
            ||
| 459 | ));  | 
            ||
| 460 | }  | 
            ||
| 461 | }  | 
            ||
| 462 | }  | 
            ||
| 463 | |||
| 464 | break;  | 
            ||
| 465 | |||
| 466 | default:  | 
            ||
| 467 | $this->abortIf(true,'Migration cannot be executed on "'.$platform.'".');  | 
            ||
| 468 | break;  | 
            ||
| 469 | }  | 
            ||
| 571 |