diff options
-rw-r--r-- | db/migrate/20131117024504_change_ids_to_unsigned.rb | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/db/migrate/20131117024504_change_ids_to_unsigned.rb b/db/migrate/20131117024504_change_ids_to_unsigned.rb index 6530dc5..ebf998f 100644 --- a/db/migrate/20131117024504_change_ids_to_unsigned.rb +++ b/db/migrate/20131117024504_change_ids_to_unsigned.rb @@ -1,43 +1,45 @@ -class ChangeIdsToUnsigned < ActiveRecord::Migration - def up - # accounts - execute "ALTER TABLE accounts " + - "MODIFY user_id bigint unsigned NOT NULL" +if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::MysqlAdapter) + class ChangeIdsToUnsigned < ActiveRecord::Migration + def up + # accounts + execute "ALTER TABLE accounts " + + "MODIFY user_id bigint unsigned NOT NULL" - # tweets - execute "ALTER TABLE tweets " + - "MODIFY user_id bigint unsigned NOT NULL, " + - "MODIFY in_reply_to_id bigint unsigned DEFAULT NULL" + # tweets + execute "ALTER TABLE tweets " + + "MODIFY user_id bigint unsigned NOT NULL, " + + "MODIFY in_reply_to_id bigint unsigned DEFAULT NULL" - # favorites - execute "ALTER TABLE favorites " + - "MODIFY user_id bigint unsigned NOT NULL, " + - "MODIFY tweet_id bigint unsigned NOT NULL" + # favorites + execute "ALTER TABLE favorites " + + "MODIFY user_id bigint unsigned NOT NULL, " + + "MODIFY tweet_id bigint unsigned NOT NULL" - # retweets - execute "ALTER TABLE retweets " + - "MODIFY user_id bigint unsigned NOT NULL, " + - "MODIFY tweet_id bigint unsigned NOT NULL" - end + # retweets + execute "ALTER TABLE retweets " + + "MODIFY user_id bigint unsigned NOT NULL, " + + "MODIFY tweet_id bigint unsigned NOT NULL" + end - def down - # accounts - execute "ALTER TABLE accounts " + - "MODIFY user_id bigint NOT NULL" + def down + # accounts + execute "ALTER TABLE accounts " + + "MODIFY user_id bigint NOT NULL" - # tweets - execute "ALTER TABLE tweets " + - "MODIFY user_id bigint NOT NULL, " + - "MODIFY in_reply_to_id bigint DEFAULT NULL" + # tweets + execute "ALTER TABLE tweets " + + "MODIFY user_id bigint NOT NULL, " + + "MODIFY in_reply_to_id bigint DEFAULT NULL" - # favorites - execute "ALTER TABLE favorites " + - "MODIFY user_id bigint NOT NULL, " + - "MODIFY tweet_id bigint NOT NULL" + # favorites + execute "ALTER TABLE favorites " + + "MODIFY user_id bigint NOT NULL, " + + "MODIFY tweet_id bigint NOT NULL" - # retweets - execute "ALTER TABLE retweets " + - "MODIFY user_id bigint NOT NULL, " + - "MODIFY tweet_id bigint NOT NULL" + # retweets + execute "ALTER TABLE retweets " + + "MODIFY user_id bigint NOT NULL, " + + "MODIFY tweet_id bigint NOT NULL" + end end end |