artist versions: convert other_names, url_string to arrays (#3987).
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class ChangeStringsToArraysOnArtistVersions < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
ArtistVersion.without_timeout do
|
||||
change_column :artist_versions, :other_names, "text[]", using: "array_remove(regexp_split_to_array(other_names, '\\s+'), '')", default: "{}"
|
||||
|
||||
change_column :artist_versions, :url_string, "text[]", using: "array_remove(regexp_split_to_array(url_string, '\\s+'), '')", default: "{}"
|
||||
rename_column :artist_versions, :url_string, :urls
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
ArtistVersion.without_timeout do
|
||||
rename_column :artist_versions, :urls, :url_string
|
||||
change_column :artist_versions, :url_string, "text", using: "array_to_string(url_string, '\\n')", default: nil
|
||||
|
||||
change_column :artist_versions, :other_names, "text", using: "array_to_string(other_names, ' ')", default: nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -726,9 +726,9 @@ CREATE TABLE public.artist_versions (
|
||||
updater_id integer NOT NULL,
|
||||
updater_ip_addr inet NOT NULL,
|
||||
is_active boolean DEFAULT true NOT NULL,
|
||||
other_names text,
|
||||
other_names text[] DEFAULT '{}'::text[],
|
||||
group_name character varying,
|
||||
url_string text,
|
||||
urls text[] DEFAULT '{}'::text[],
|
||||
is_banned boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone
|
||||
@@ -7573,6 +7573,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20181108162204'),
|
||||
('20181108205842'),
|
||||
('20181113174914'),
|
||||
('20181114180205');
|
||||
('20181114180205'),
|
||||
('20181114185032');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user