3 ms·
Yes, but on how many different systems and dev setups do you have to run that?
by jjeaff 8y ago
Yes, 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;