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.
This commit is contained in:
evazion
2020-03-06 14:50:21 -06:00
parent 49a3538933
commit 4c11e339bd
16 changed files with 68 additions and 42 deletions

View File

@@ -0,0 +1,25 @@
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

View File

@@ -594,7 +594,7 @@ ALTER SEQUENCE public.artist_versions_id_seq OWNED BY public.artist_versions.id;
CREATE TABLE public.artists (
id integer NOT NULL,
name character varying NOT NULL,
is_active boolean DEFAULT true NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
is_banned boolean DEFAULT false NOT NULL,
other_names text[] DEFAULT '{}'::text[] NOT NULL,
group_name character varying DEFAULT ''::character varying NOT NULL,
@@ -7307,6 +7307,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200123184743'),
('20200217044719'),
('20200223042415'),
('20200223234015');
('20200223234015'),
('20200306202253');