migrate003.sql 660 B

12345678910111213141516171819202122
  1. alter table contract_store
  2. add column contract_id bigint;
  3. alter table contract_room
  4. add column contract_id bigint;
  5. update contract_store join contract on contract_store.contract_number = contract.contract_number
  6. set contract_store.contract_id = contract.id;
  7. update contract_room join contract on contract_room.contract_number = contract.contract_number
  8. set contract_room.contract_id = contract.id;
  9. rename table contract_room to contract_room_type;
  10. update contract_room_type
  11. set store_id = store_info_id;
  12. alter table contract_room_type
  13. drop column store_info_id;
  14. alter table residence_room_type
  15. change store_info_id store_id bigint null;