addSql(<<<'SQL' WITH type_to_id AS ( SELECT DISTINCT charge.charge_id AS id, charge.type FROM chill_budget.charge WHERE type <> '' ) UPDATE chill_budget.charge_type SET kind = type_to_id.type FROM type_to_id WHERE type_to_id.type <> '' AND type_to_id.id = charge_type.id SQL); $this->addSql(<<<'SQL' WITH type_to_id AS ( SELECT DISTINCT resource.resource_id AS id, resource.type FROM chill_budget. resource WHERE type <> '' ) UPDATE chill_budget.resource_type SET kind = type_to_id.type FROM type_to_id WHERE type_to_id.type <> '' AND type_to_id.id = resource_type.id SQL); } public function down(Schema $schema): void { $this->addSql("UPDATE chill_budget.resource_type SET kind=md5(random()::text) WHERE kind = ''"); $this->addSql("UPDATE chill_budget.charge_type SET kind=md5(random()::text) WHERE kind = ''"); } }