fix migration for circleci
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
class ChangeDescendantNamesToArrayOnTagImplications < ActiveRecord::Migration[5.2]
|
class ChangeDescendantNamesToArrayOnTagImplications < ActiveRecord::Migration[5.2]
|
||||||
def up
|
def up
|
||||||
TagImplication.without_timeout do
|
TagImplication.without_timeout do
|
||||||
change_column_default :tag_implications, :descendant_names, from: '', to: nil
|
add_column :tag_implications, :descendant_names_array, "text[]", default: "{}"
|
||||||
change_column :tag_implications, :descendant_names, "text[]", using: "string_to_array(descendant_names, ' ')::text[]", default: "{}"
|
execute "update tag_implications set descendant_names_array = string_to_array(descendant_names, ' ')::text[]"
|
||||||
|
remove_column :tag_implications, :descendant_names
|
||||||
|
rename_column :tag_implications, :descendant_names_array, :descendant_names
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
class ChangeStringsToArraysOnArtistVersions < ActiveRecord::Migration[5.2]
|
class ChangeStringsToArraysOnArtistVersions < ActiveRecord::Migration[5.2]
|
||||||
def up
|
def up
|
||||||
ArtistVersion.without_timeout do
|
ArtistVersion.without_timeout do
|
||||||
change_column_default :artist_versions, :other_names, from: '', to: nil
|
add_column :artist_versions, :other_names_array, "text[]", default: "{}"
|
||||||
change_column :artist_versions, :other_names, "text[]", using: "array_remove(regexp_split_to_array(other_names, '\\s+'), '')", default: "{}"
|
execute "update artist_versions set other_names_array = array_remove(regexp_split_to_array(other_names, '\\s+'), '')"
|
||||||
|
remove_column :artist_versions, :other_names
|
||||||
|
rename_column :artist_versions, :other_names_array, :other_names
|
||||||
|
|
||||||
change_column :artist_versions, :url_string, "text[]", using: "array_remove(regexp_split_to_array(url_string, '\\s+'), '')", default: "{}"
|
add_column :artist_versions, :urls, "text[]", default: "{}"
|
||||||
rename_column :artist_versions, :url_string, :urls
|
execute "update artist_versions set urls = array_remove(regexp_split_to_array(url_string, '\\s+'), '')"
|
||||||
|
remove_column :artist_versions, :url_string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
|||||||
setup do
|
setup do
|
||||||
@urls = [
|
@urls = [
|
||||||
FactoryBot.create(:artist_url, url: "https://www.artstation.com/koyorin"),
|
FactoryBot.create(:artist_url, url: "https://www.artstation.com/koyorin"),
|
||||||
FactoryBot.create(:artist_url, url: "https://www.artstation.com/artist/koyorin"),
|
|
||||||
FactoryBot.create(:artist_url, url: "https://koyorin.artstation.com"),
|
FactoryBot.create(:artist_url, url: "https://koyorin.artstation.com"),
|
||||||
FactoryBot.create(:artist_url, url: "https://www.artstation.com/artwork/04XA4")
|
FactoryBot.create(:artist_url, url: "https://www.artstation.com/artwork/04XA4")
|
||||||
]
|
]
|
||||||
@@ -74,8 +73,7 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
|||||||
should "normalize" do
|
should "normalize" do
|
||||||
assert_equal("http://www.artstation.com/koyorin/", @urls[0].normalized_url)
|
assert_equal("http://www.artstation.com/koyorin/", @urls[0].normalized_url)
|
||||||
assert_equal("http://www.artstation.com/koyorin/", @urls[1].normalized_url)
|
assert_equal("http://www.artstation.com/koyorin/", @urls[1].normalized_url)
|
||||||
assert_equal("http://www.artstation.com/koyorin/", @urls[2].normalized_url)
|
assert_equal("http://www.artstation.com/jeyrain/", @urls[2].normalized_url)
|
||||||
assert_equal("http://www.artstation.com/jeyrain/", @urls[3].normalized_url)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user