fix(db): make common field attribute rollback safe
This commit is contained in:
@@ -34,6 +34,16 @@ export class F63MobileFieldCommonAttributes1790099100000 implements MigrationInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`
|
||||||
|
DELETE FROM asset_attribute_values value
|
||||||
|
USING asset_attribute_definitions definition, asset_types type
|
||||||
|
WHERE value.definition_id=definition.id
|
||||||
|
AND definition.asset_type_id=type.id
|
||||||
|
AND lower(type.code) IN ('instalacion','subinstalacion')
|
||||||
|
AND definition.code IN (
|
||||||
|
'campo_marca','campo_modelo','campo_capacidad','campo_numero_serie','campo_funcion'
|
||||||
|
)
|
||||||
|
`);
|
||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
DELETE FROM asset_attribute_definitions definition
|
DELETE FROM asset_attribute_definitions definition
|
||||||
USING asset_types type
|
USING asset_types type
|
||||||
|
|||||||
Reference in New Issue
Block a user