fix(f5): make catalog SQL text parameter types explicit
This commit is contained in:
+12
-12
@@ -156,17 +156,17 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
|
||||
await queryRunner.query(`
|
||||
INSERT INTO finding_categories(code,name,sort_order,is_active)
|
||||
SELECT $1,'DH · Modelo de Inventarios F5',270,true
|
||||
WHERE NOT EXISTS (SELECT 1 FROM finding_categories WHERE lower(code)=lower($1))
|
||||
SELECT $1::varchar,'DH · Modelo de Inventarios F5',270,true
|
||||
WHERE NOT EXISTS (SELECT 1 FROM finding_categories WHERE lower(code)=lower($1::varchar))
|
||||
`, [CATALOG_CATEGORY_CODE]);
|
||||
await queryRunner.query(`
|
||||
UPDATE finding_categories
|
||||
SET name='DH · Modelo de Inventarios F5',sort_order=270,is_active=true,updated_at=CURRENT_TIMESTAMP
|
||||
WHERE lower(code)=lower($1)
|
||||
WHERE lower(code)=lower($1::varchar)
|
||||
`,[CATALOG_CATEGORY_CODE]);
|
||||
const categoryId = await this.id(
|
||||
queryRunner,
|
||||
`SELECT id FROM finding_categories WHERE lower(code)=lower($1) LIMIT 1`,
|
||||
`SELECT id FROM finding_categories WHERE lower(code)=lower($1::varchar) LIMIT 1`,
|
||||
[CATALOG_CATEGORY_CODE],
|
||||
'F5 finding category',
|
||||
);
|
||||
@@ -192,7 +192,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
const itemCode = hashCode('F5-H',itemKey);
|
||||
let itemId = await this.optionalId(
|
||||
queryRunner,
|
||||
`SELECT id FROM finding_catalog_items WHERE lower(code)=lower($1) LIMIT 1`,
|
||||
`SELECT id FROM finding_catalog_items WHERE lower(code)=lower($1::varchar) LIMIT 1`,
|
||||
[itemCode],
|
||||
);
|
||||
if (!itemId) {
|
||||
@@ -313,7 +313,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
const categoryId = await this.optionalId(
|
||||
queryRunner,
|
||||
`SELECT id FROM finding_categories WHERE lower(code)=lower($1) LIMIT 1`,
|
||||
`SELECT id FROM finding_categories WHERE lower(code)=lower($1::varchar) LIMIT 1`,
|
||||
[CATALOG_CATEGORY_CODE],
|
||||
);
|
||||
|
||||
@@ -341,7 +341,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
|
||||
await queryRunner.query(`
|
||||
DELETE FROM finding_catalog_asset_overrides
|
||||
WHERE reason=$1
|
||||
WHERE reason=$1::text
|
||||
`,[F5_AUTO_REASON]);
|
||||
|
||||
if (categoryId) {
|
||||
@@ -384,7 +384,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DELETE FROM source_documents
|
||||
WHERE document_number=$1 AND issuer='Dirección de Hidrocarburos'
|
||||
WHERE document_number=$1::varchar AND issuer='Dirección de Hidrocarburos'
|
||||
`,[CATALOG_DOCUMENT_NUMBER]);
|
||||
await this.restoreF31FamilySyncFunctions(queryRunner);
|
||||
|
||||
@@ -430,7 +430,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
`,[familyCode,name,level,sourceReference]);
|
||||
return this.id(
|
||||
queryRunner,
|
||||
`SELECT id FROM inventory_families WHERE code=$1 LIMIT 1`,
|
||||
`SELECT id FROM inventory_families WHERE code=$1::varchar LIMIT 1`,
|
||||
[familyCode],
|
||||
`inventory family ${familyCode}`,
|
||||
);
|
||||
@@ -453,7 +453,7 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
): Promise<void> {
|
||||
const familyId = await this.id(
|
||||
queryRunner,
|
||||
`SELECT id FROM inventory_families WHERE code=$1 LIMIT 1`,
|
||||
`SELECT id FROM inventory_families WHERE code=$1::varchar LIMIT 1`,
|
||||
[familyCode],
|
||||
`family ${familyCode}`,
|
||||
);
|
||||
@@ -530,14 +530,14 @@ export class F5AuthoritativeInventoryCatalog1790087300000 implements MigrationIn
|
||||
INSERT INTO finding_catalog_asset_overrides(
|
||||
asset_id,catalog_item_id,is_enabled,reason,created_by,updated_by
|
||||
)
|
||||
SELECT asset.id,mapping.catalog_item_id,true,$1,
|
||||
SELECT asset.id,mapping.catalog_item_id,true,$1::text,
|
||||
asset.created_by,asset.updated_by
|
||||
FROM assets asset
|
||||
JOIN finding_catalog_item_inventory_families mapping
|
||||
ON mapping.inventory_family_id=asset.inventory_family_id
|
||||
WHERE asset.inventory_family_id IS NOT NULL
|
||||
ON CONFLICT (asset_id,catalog_item_id) DO UPDATE SET
|
||||
is_enabled=true,reason=$1,updated_at=CURRENT_TIMESTAMP
|
||||
is_enabled=true,reason=$1::text,updated_at=CURRENT_TIMESTAMP
|
||||
`,[F5_AUTO_REASON]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user