diff --git a/service/src/main/resources/db/migration/V1.78__Backup_Beacon_View_Latest_Legacy_Claim_Left_Join.sql b/service/src/main/resources/db/migration/V1.78__Backup_Beacon_View_Latest_Legacy_Claim_Left_Join.sql deleted file mode 100644 index a30a83c3b..000000000 --- a/service/src/main/resources/db/migration/V1.78__Backup_Beacon_View_Latest_Legacy_Claim_Left_Join.sql +++ /dev/null @@ -1,72 +0,0 @@ -DROP VIEW beacon_backup; -CREATE OR REPLACE VIEW beacon_backup AS - -SELECT * -FROM (SELECT b.id, - b.hex_id, - b.beacon_status, - 'MODERN' as category, - b.created_date, - b.last_modified_date, - -- legacy beacons only - NULL as data, - NULL as owner_name, - NULL as owner_email, - NULL as use_activities, - NULL as recovery_email, - NULL as cospas_sarsat_number, - -- modern beacons only - b.manufacturer, - b.model, - b.manufacturer_serial_number, - b.battery_expiry_date, - b.last_serviced_date, - b.chk_code, - b.reference_number, - b.mti, - b.svdr, - b.csta, - b.beacon_type, - b.protocol, - b.coding, - b.account_holder_id - FROM beacon b - UNION ALL - SELECT legacy_beacon.id as id, - legacy_beacon.hex_id as hex_id, - COALESCE(UPPER('DELETED (' || claim_event_type::text || 'ED)'), - UPPER(legacy_beacon.beacon_status)) AS beacon_status, - 'LEGACY' as category, - legacy_beacon.created_date, - legacy_beacon.last_modified_date, - -- legacy only - legacy_beacon.data, - legacy_beacon.owner_name, - legacy_beacon.owner_email, - legacy_beacon.use_activities, - legacy_beacon.recovery_email as recovery_email, - - -- legacy beacon data fields - (legacy_beacon.data -> 'beacon' ->> 'cospasSarsatNumber') as cospas_sarsat_number, - (legacy_beacon.data -> 'beacon' ->> 'manufacturer') as manufacturer, - (legacy_beacon.data -> 'beacon' ->> 'model') as model, - (legacy_beacon.data -> 'beacon' ->> 'manufacturerSerialNumber') as manufacturer_serial_number, - NULL as battery_expiry_date, - NULL as last_serviced_date, - (legacy_beacon.data -> 'beacon' ->> 'chk_code') as chk_code, - (legacy_beacon.data -> 'beacon' ->> 'reference_number') as reference_number, - (legacy_beacon.data -> 'beacon' ->> 'mti') as mti, - NULL as svdr, - (legacy_beacon.data -> 'beacon' ->> 'csta') as csta, - (legacy_beacon.data -> 'beacon' ->> 'beaconType') as beacon_type, - (legacy_beacon.data -> 'beacon' ->> 'protocol') as protocol, - (legacy_beacon.data -> 'beacon' ->> 'coding') as coding, - - -- modern beacons only - NULL AS account_holder_id - FROM legacy_beacon_claim_event c - LEFT JOIN legacy_beacon ON c.legacy_beacon_id = legacy_beacon.id - WHERE c.when_happened = (SELECT MAX(when_happened) - FROM legacy_beacon_claim_event - WHERE legacy_beacon_id = legacy_beacon.id)) AS beacon_backup -ORDER BY beacon_backup.last_modified_date DESC, beacon_backup.hex_id ASC; diff --git a/service/src/main/resources/db/migration/V1.79__Backup_Beacon_View_Latest_Legacy_Claim_Max.sql b/service/src/main/resources/db/migration/V1.79__Backup_Beacon_View_Latest_Legacy_Claim_Max.sql deleted file mode 100644 index a7252cfe0..000000000 --- a/service/src/main/resources/db/migration/V1.79__Backup_Beacon_View_Latest_Legacy_Claim_Max.sql +++ /dev/null @@ -1,73 +0,0 @@ -DROP VIEW beacon_backup; -CREATE OR REPLACE VIEW beacon_backup AS - -SELECT * -FROM (SELECT b.id, - b.hex_id, - b.beacon_status, - 'MODERN' as category, - b.created_date, - b.last_modified_date, - -- legacy beacons only - NULL as data, - NULL as owner_name, - NULL as owner_email, - NULL as use_activities, - NULL as recovery_email, - NULL as cospas_sarsat_number, - -- modern beacons only - b.manufacturer, - b.model, - b.manufacturer_serial_number, - b.battery_expiry_date, - b.last_serviced_date, - b.chk_code, - b.reference_number, - b.mti, - b.svdr, - b.csta, - b.beacon_type, - b.protocol, - b.coding, - b.account_holder_id - FROM beacon b - UNION ALL - SELECT legacy_beacon.id as id, - legacy_beacon.hex_id as hex_id, - COALESCE(UPPER('DELETED (' || claim_event_type::text || 'ED)'), - UPPER(legacy_beacon.beacon_status)) AS beacon_status, - 'LEGACY' as category, - legacy_beacon.created_date, - legacy_beacon.last_modified_date, - -- legacy only - legacy_beacon.data, - legacy_beacon.owner_name, - legacy_beacon.owner_email, - legacy_beacon.use_activities, - legacy_beacon.recovery_email as recovery_email, - - -- legacy beacon data fields - (legacy_beacon.data -> 'beacon' ->> 'cospasSarsatNumber') as cospas_sarsat_number, - (legacy_beacon.data -> 'beacon' ->> 'manufacturer') as manufacturer, - (legacy_beacon.data -> 'beacon' ->> 'model') as model, - (legacy_beacon.data -> 'beacon' ->> 'manufacturerSerialNumber') as manufacturer_serial_number, - NULL as battery_expiry_date, - NULL as last_serviced_date, - (legacy_beacon.data -> 'beacon' ->> 'chk_code') as chk_code, - (legacy_beacon.data -> 'beacon' ->> 'reference_number') as reference_number, - (legacy_beacon.data -> 'beacon' ->> 'mti') as mti, - NULL as svdr, - (legacy_beacon.data -> 'beacon' ->> 'csta') as csta, - (legacy_beacon.data -> 'beacon' ->> 'beaconType') as beacon_type, - (legacy_beacon.data -> 'beacon' ->> 'protocol') as protocol, - (legacy_beacon.data -> 'beacon' ->> 'coding') as coding, - - -- modern beacons only - NULL AS account_holder_id - FROM legacy_beacon - LEFT JOIN (SELECT legacy_beacon_id, MAX(when_happened) AS max_when_happened - FROM legacy_beacon_claim_event - GROUP BY legacy_beacon_id) c ON legacy_beacon.id = c.legacy_beacon_id - WHERE c.when_happened IS NULL - OR c.when_happened = legacy_beacon_claim_event.max_when_happened) AS beacon_backup -ORDER BY beacon_backup.last_modified_date DESC, beacon_backup.hex_id ASC;