From f34b03d64bb884ecd98ff79e40fc70bb6b53e228 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 12 Oct 2014 13:26:07 +0300 Subject: [PATCH] Add schedule model --- app/models/hall.rb | 3 +++ app/models/slot.rb | 4 ++++ db/migrate/20141012100900_create_halls.rb | 10 ++++++++++ db/migrate/20141012101004_create_slots.rb | 12 ++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 app/models/hall.rb create mode 100644 app/models/slot.rb create mode 100644 db/migrate/20141012100900_create_halls.rb create mode 100644 db/migrate/20141012101004_create_slots.rb diff --git a/app/models/hall.rb b/app/models/hall.rb new file mode 100644 index 0000000..9661672 --- /dev/null +++ b/app/models/hall.rb @@ -0,0 +1,3 @@ +class Hall < ActiveRecord::Base + belongs_to :conference +end diff --git a/app/models/slot.rb b/app/models/slot.rb new file mode 100644 index 0000000..bb5509c --- /dev/null +++ b/app/models/slot.rb @@ -0,0 +1,4 @@ +class Slot < ActiveRecord::Base + belongs_to :hall + belongs_to :event +end diff --git a/db/migrate/20141012100900_create_halls.rb b/db/migrate/20141012100900_create_halls.rb new file mode 100644 index 0000000..6825079 --- /dev/null +++ b/db/migrate/20141012100900_create_halls.rb @@ -0,0 +1,10 @@ +class CreateHalls < ActiveRecord::Migration + def change + create_table :halls do |t| + t.references :conference, index: true + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20141012101004_create_slots.rb b/db/migrate/20141012101004_create_slots.rb new file mode 100644 index 0000000..379cd0b --- /dev/null +++ b/db/migrate/20141012101004_create_slots.rb @@ -0,0 +1,12 @@ +class CreateSlots < ActiveRecord::Migration + def change + create_table :slots do |t| + t.references :hall, index: true + t.timestamp :starts_at, null: false + t.timestamp :ends_at, null: false + t.references :event, index: true + + t.timestamps + end + end +end