Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
fix hardware_product and relay migration queries
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge committed Dec 13, 2019
1 parent be6e63c commit e85881a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sql/migrations/0140-hardware_product_profile.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ SELECT run_migration(140, $$
from hardware_product_profile
where hardware_product_profile.hardware_product_id = hardware_product.id;

update hardware_product set purpose = 'not yet working entry' where purpose is null;
update hardware_product set bios_firmware = '' where bios_firmware is null;
update hardware_product set cpu_num = 0 where cpu_num is null;
update hardware_product set cpu_type = '' where cpu_type is null;
update hardware_product set dimms_num = 0 where dimms_num is null;
update hardware_product set ram_total = 0 where ram_total is null;
update hardware_product set nics_num = 0 where nics_num is null;
update hardware_product set sata_hdd_num = 0 where sata_hdd_num is null;
update hardware_product set sas_hdd_num = 0 where sas_hdd_num is null;
update hardware_product set sata_ssd_num = 0 where sata_ssd_num is null;
update hardware_product set psu_total = 0 where psu_total is null;
update hardware_product set usb_num = 0 where usb_num is null;
update hardware_product set sas_ssd_num = 0 where sas_ssd_num is null;
update hardware_product set nvme_ssd_num = 0 where nvme_ssd_num is null;
update hardware_product set raid_lun_num = 0 where raid_lun_num is null;

alter table hardware_product
alter column purpose set not null,
alter column bios_firmware set not null,
Expand Down
3 changes: 3 additions & 0 deletions sql/migrations/0141-user_relay_connection.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ SELECT run_migration(141, $$
from user_relay_connection
where user_relay_connection.relay_id = relay.id;

-- these relays were never used and don't need to be preserved.
delete from relay where user_id is null;

create index relay_user_id on relay (user_id);

alter table relay alter column user_id set not null;
Expand Down

0 comments on commit e85881a

Please sign in to comment.