mirror of
https://github.com/moebooru/moebooru
synced 2025-08-22 01:47:48 +00:00
11 lines
364 B
Ruby
11 lines
364 B
Ruby
class FavoritesAddCreatedAt < ActiveRecord::Migration[5.1]
|
|
def self.up
|
|
execute "alter table favorites add column created_at timestamp not null default now()"
|
|
execute "update favorites set created_at = (select created_at from posts where id = favorites.post_id)"
|
|
end
|
|
|
|
def self.down
|
|
execute "alter table favorites drop column created_at"
|
|
end
|
|
end
|