Add number of pieces to puzzles
All checks were successful
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 34s

This commit is contained in:
sto
2025-06-27 09:23:25 +02:00
parent b6da55723d
commit 0599def237
9 changed files with 51 additions and 39 deletions

View File

@@ -0,0 +1,12 @@
class AddPiecesToPuzzle < ActiveRecord::Migration[8.0]
def change
add_column :puzzles, :pieces, :integer
Puzzle.find_each do |puzzle|
puzzle.pieces = 500
puzzle.save
end
change_column_null :puzzles, :pieces, false
end
end

3
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_06_25_075513) do
ActiveRecord::Schema[8.0].define(version: 2025_06_27_070407) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -115,6 +115,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_25_075513) do
t.datetime "updated_at", null: false
t.integer "contest_id", null: false
t.string "brand"
t.integer "pieces", null: false
t.index ["contest_id"], name: "index_puzzles_on_contest_id"
end