Skip to content

Instantly share code, notes, and snippets.

@thurloat
Created October 17, 2011 16:15
Show Gist options
  • Select an option

  • Save thurloat/1292983 to your computer and use it in GitHub Desktop.

Select an option

Save thurloat/1292983 to your computer and use it in GitHub Desktop.
Automated Migrations? For fools!
ALTER TABLE `news_items` DROP COLUMN updated;
ALTER TABLE `news_items` ADD COLUMN updated datetime DEFAULT NULL;
ALTER TABLE `news_items` CHANGE `timestamp` `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP;
UPDATE `news_items` as item SET `updated` = item.`timestamp`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment