Introduces new audience object

#416
This commit is contained in:
Chrisbr 2014-08-12 17:59:35 +02:00
parent 63d2980fe3
commit 27fc0acbf8
24 changed files with 388 additions and 116 deletions

View file

@ -0,0 +1,12 @@
class CreateAudiences < ActiveRecord::Migration
def change
create_table :audiences do |t|
t.integer :conference_id
t.date :registration_start_date
t.date :registration_end_date
t.text :registration_description
t.timestamps
end
end
end

View file

@ -0,0 +1,27 @@
class MoveConferenceRegistrationDataToAudience < ActiveRecord::Migration
class TempConference < ActiveRecord::Base
self.table_name = 'conferences'
end
class TempAudience < ActiveRecord::Base
self.table_name = 'audiences'
attr_accessible :conference_id, :registration_start_date, :registration_end_date, :registration_description
end
def change
# Move all the settings to the new object
TempConference.all.each do |conference|
unless TempAudience.exists?(conference_id: conference.id)
TempAudience.create(conference_id: conference.id,
registration_start_date: conference.registration_start_date,
registration_end_date: conference.registration_end_date,
registration_description: conference.registration_description)
end
end
# Remove Columns
remove_column :conferences, :registration_start_date
remove_column :conferences, :registration_end_date
remove_column :conferences, :registration_description
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140801170430) do
ActiveRecord::Schema.define(version: 20140812065531) do
create_table "ahoy_events", force: true do |t|
t.uuid "visit_id"
@ -31,6 +31,15 @@ ActiveRecord::Schema.define(version: 20140801170430) do
t.datetime "updated_at"
end
create_table "audiences", force: true do |t|
t.integer "conference_id"
t.date "registration_start_date"
t.date "registration_end_date"
t.text "registration_description"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "call_for_papers", force: true do |t|
t.date "start_date", null: false
t.date "end_date", null: false
@ -94,8 +103,6 @@ ActiveRecord::Schema.define(version: 20140801170430) do
t.integer "venue_id"
t.datetime "created_at"
t.datetime "updated_at"
t.date "registration_start_date"
t.date "registration_end_date"
t.string "logo_file_name"
t.string "logo_content_type"
t.integer "logo_file_size"
@ -109,7 +116,6 @@ ActiveRecord::Schema.define(version: 20140801170430) do
t.boolean "use_volunteers"
t.string "color"
t.text "description"
t.text "registration_description"
t.text "ticket_description"
t.text "sponsor_description"
t.string "sponsor_email"