Files
danbooru/db/migrate/20200306202253_rename_is_active_on_artists.rb
evazion 4c11e339bd artists: rename is_active flag to is_deleted.
Rename is_active to is_deleted. This is for better consistency with
other models, and to reduce confusion over what "active" means for
artists. Sometimes users think active is for whether the artist is
actively producing work.
2020-03-06 14:50:21 -06:00

26 lines
966 B
Ruby

class RenameIsActiveOnArtists < ActiveRecord::Migration[6.0]
def up
execute "SET statement_timeout = 0"
rename_column :artists, :is_active, :is_deleted
change_column_default :artists, :is_deleted, from: true, to: false
execute "UPDATE artists SET is_deleted = NOT is_deleted"
rename_column :artist_versions, :is_active, :is_deleted
change_column_default :artist_versions, :is_deleted, from: true, to: false
execute "UPDATE artist_versions SET is_deleted = NOT is_deleted"
end
def down
execute "SET statement_timeout = 0"
execute "UPDATE artists SET is_deleted = NOT is_deleted"
change_column_default :artists, :is_deleted, from: false, to: true
rename_column :artists, :is_deleted, :is_active
execute "UPDATE artist_versions SET is_deleted = NOT is_deleted"
change_column_default :artist_versions, :is_deleted, from: false, to: true
rename_column :artist_versions, :is_deleted, :is_active
end
end