diff --git a/app/models/physical_ticket.rb b/app/models/physical_ticket.rb index a0874a6e..6142c875 100644 --- a/app/models/physical_ticket.rb +++ b/app/models/physical_ticket.rb @@ -3,4 +3,5 @@ class PhysicalTicket < ActiveRecord::Base has_one :ticket, through: :ticket_purchase has_one :conference, through: :ticket_purchase has_one :user, through: :ticket_purchase + has_many :ticket_scannings end diff --git a/app/models/ticket_scanning.rb b/app/models/ticket_scanning.rb new file mode 100644 index 00000000..6ce9d00c --- /dev/null +++ b/app/models/ticket_scanning.rb @@ -0,0 +1,3 @@ +class TicketScanning < ActiveRecord::Base + belongs_to :physical_ticket +end diff --git a/db/migrate/20170711102511_create_ticket_scannings.rb b/db/migrate/20170711102511_create_ticket_scannings.rb new file mode 100644 index 00000000..d1879f68 --- /dev/null +++ b/db/migrate/20170711102511_create_ticket_scannings.rb @@ -0,0 +1,9 @@ +class CreateTicketScannings < ActiveRecord::Migration + def change + create_table :ticket_scannings do |t| + t.integer :physical_ticket_id, null: false + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index af227946..b9f8e3f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170629232817) do +ActiveRecord::Schema.define(version: 20170711102511) do create_table "ahoy_events", force: :cascade do |t| t.uuid "visit_id", limit: 16 @@ -468,6 +468,12 @@ ActiveRecord::Schema.define(version: 20170629232817) do t.integer "week" end + create_table "ticket_scannings", force: :cascade do |t| + t.integer "physical_ticket_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "tickets", force: :cascade do |t| t.integer "conference_id" t.string "title", null: false