2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 09:57:31 +00:00
moebooru/db/migrate/20081203035506_add_is_held_to_posts.rb

14 lines
478 B
Ruby
Raw Permalink Normal View History

class AddIsHeldToPosts < ActiveRecord::Migration[5.1]
def self.up
execute "ALTER TABLE posts ADD COLUMN is_held BOOLEAN NOT NULL DEFAULT FALSE"
execute "ALTER TABLE posts ADD COLUMN index_timestamp TIMESTAMP NOT NULL DEFAULT now()"
execute "UPDATE posts SET index_timestamp = created_at"
add_index :posts, :is_held
end
def self.down
execute "ALTER TABLE posts DROP COLUMN is_held"
execute "ALTER TABLE posts DROP COLUMN index_timestamp"
end
end