4 ms·
I'm confused. Wouldn't this type of statement cover those cases? INSERT INTO tbl_temp2 (fld_id) SELECT tbl_temp1.fld_order_id FROM tbl_temp1 WHERE tbl_tem
by wolco 8y ago
I'm confused. Wouldn't this type of statement cover those cases?
INSERT INTO tbl_temp2 (fld_id)
SELECT tbl_temp1.fld_order_id
FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;
- jjeaff 8y agoYes, but on how many different systems and dev setups do you have to run that?
- zepolen 8y agoAll of them. It would be part of your migration process. Let's say you want users to have multiple emails, your scripts would be as follows: multiple_emails.up.sql: CREATE TABLE user_emails ( user_id INT NOT NULL REFERENCES (users.id), email VARCHAR NOT NULL ); INSERT INTO user_emails SELECT id, email FROM users; ALTER TABLE users DROP COLUMN email; multiple_emails.down.sql: ALTER TABLE users ADD COLUMN email VARCHAR; INSERT INTO users SELECT id, email FROM users; DROP TABLE user_emails;