DEV: Apply syntax_tree formatting to db/*

This commit is contained in:
David Taylor
2023-01-09 11:59:41 +00:00
parent cb932d6ee1
commit b0fda61a8e
467 changed files with 1682 additions and 1624 deletions

View File

@@ -2,7 +2,7 @@
class AddUploadIdToThemeFields < ActiveRecord::Migration[4.2]
def up
remove_index :theme_fields, [:theme_id, :target, :name]
remove_index :theme_fields, %i[theme_id target name]
rename_column :theme_fields, :target, :target_id
# we need a throwaway column here to keep running
@@ -14,16 +14,19 @@ class AddUploadIdToThemeFields < ActiveRecord::Migration[4.2]
add_column :theme_fields, :upload_id, :integer
add_column :theme_fields, :type_id, :integer, null: false, default: 0
add_index :theme_fields, [:theme_id, :target_id, :type_id, :name], unique: true, name: 'theme_field_unique_index'
add_index :theme_fields,
%i[theme_id target_id type_id name],
unique: true,
name: "theme_field_unique_index"
execute "UPDATE theme_fields SET type_id = 1 WHERE name IN ('scss', 'embedded_scss')"
end
def down
remove_column :theme_fields, :target
execute 'drop index theme_field_unique_index'
execute "drop index theme_field_unique_index"
rename_column :theme_fields, :target_id, :target
remove_column :theme_fields, :upload_id
remove_column :theme_fields, :type_id
add_index :theme_fields, [:theme_id, :target, :name], unique: true
add_index :theme_fields, %i[theme_id target name], unique: true
end
end