drop legacy path columns
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
class DropLegacyPathColumnsFromReleases < ActiveRecord::Migration[8.1]
|
||||
COLUMN_KINDS = {
|
||||
"cartridge_path" => "cartridge",
|
||||
"source_path" => "source",
|
||||
"html_folder_path" => "html",
|
||||
"docs_folder_path" => "docs"
|
||||
}.freeze
|
||||
|
||||
def up
|
||||
COLUMN_KINDS.each_key do |column|
|
||||
remove_column :releases, column
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
COLUMN_KINDS.each_key do |column|
|
||||
add_column :releases, column, :string
|
||||
end
|
||||
|
||||
# rollbacknél az adat a release_assets-ből áll vissza, nem veszik el
|
||||
COLUMN_KINDS.each do |column, kind|
|
||||
execute <<~SQL.squish
|
||||
UPDATE releases r
|
||||
JOIN release_assets ra ON ra.release_id = r.id AND ra.kind = '#{kind}'
|
||||
SET r.#{column} = ra.path
|
||||
SQL
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_02_000001) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_02_000002) do
|
||||
create_table "admin_users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "email", default: "", null: false
|
||||
@@ -183,13 +183,9 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_02_000001) do
|
||||
end
|
||||
|
||||
create_table "releases", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "cartridge_path"
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
t.string "docs_folder_path"
|
||||
t.string "html_folder_path"
|
||||
t.bigint "software_id", unsigned: true
|
||||
t.string "source_path"
|
||||
t.datetime "updated_at", precision: 3
|
||||
t.string "version", limit: 64
|
||||
t.boolean "web_playable", default: false
|
||||
|
||||
Reference in New Issue
Block a user