blob: ebf998fcea3919f768b854e8235eb161b4a5b8ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
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"
# 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
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"
# 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"
end
end
end
|