22 lines
545 B
Ruby
Executable File
22 lines
545 B
Ruby
Executable File
class CreateTickets < ActiveRecord::Migration[8.0]
|
|
def change
|
|
create_table :tickets do |t|
|
|
t.string :qr_code
|
|
t.integer :price_cents
|
|
t.string :status, default: "draft"
|
|
|
|
# Add names to ticket
|
|
t.string :first_name
|
|
t.string :last_name
|
|
|
|
# Tickets belong to orders (orders handle payment logic)
|
|
t.references :order, null: false, foreign_key: true
|
|
t.references :ticket_type, null: false, foreign_key: true
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :tickets, :qr_code, unique: true
|
|
end
|
|
end
|