Merge some contributor fixes

This commit is contained in:
Michael Ball 2020-06-30 00:48:47 -07:00
commit 0877aadb2e
72 changed files with 225 additions and 206 deletions

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateSurveys < ActiveRecord::Migration
class CreateSurveys < ActiveRecord::Migration[5.0]
def change
create_table :surveys do |t|
t.datetime :start_date

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateSurveyQuestions < ActiveRecord::Migration
class CreateSurveyQuestions < ActiveRecord::Migration[5.0]
def change
create_table :survey_questions do |t|
t.references :survey

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddTargetToSurveys < ActiveRecord::Migration
class AddTargetToSurveys < ActiveRecord::Migration[5.0]
def change
add_column :surveys, :target, :integer, default: 0
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateSurveyReplies < ActiveRecord::Migration
class CreateSurveyReplies < ActiveRecord::Migration[5.0]
def change
create_table :survey_replies do |t|
t.integer :survey_question_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateSurveySubmissions < ActiveRecord::Migration
class CreateSurveySubmissions < ActiveRecord::Migration[5.0]
def change
create_table :survey_submissions do |t|
t.integer :user_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddCommentsCountToEvents < ActiveRecord::Migration
class AddCommentsCountToEvents < ActiveRecord::Migration[4.2]
def change
add_column :events, :comments_count, :integer, default: 0, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddDefaultToRevisionInConference < ActiveRecord::Migration
class AddDefaultToRevisionInConference < ActiveRecord::Migration[4.2]
def change
change_column :conferences, :revision, :integer, default: 0, null: false
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddEnabledToEventSchedules < ActiveRecord::Migration
class AddEnabledToEventSchedules < ActiveRecord::Migration[5.0]
def change
add_column :event_schedules, :enabled, :boolean, default: true
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateBooths < ActiveRecord::Migration
class CreateBooths < ActiveRecord::Migration[4.2]
def change
create_table :booths do |t|
t.string :title

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddTypeToCfps < ActiveRecord::Migration
class AddTypeToCfps < ActiveRecord::Migration[4.2]
class TmpCfp < ActiveRecord::Base
self.table_name = 'cfps'
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateBoothRequests < ActiveRecord::Migration
class CreateBoothRequests < ActiveRecord::Migration[4.2]
def change
create_table :booth_requests do |t|
t.references :booth, index: true, foreign_key: true

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreatePhysicalTickets < ActiveRecord::Migration
class CreatePhysicalTickets < ActiveRecord::Migration[4.2]
def change
create_table :physical_tickets do |t|
t.integer :ticket_purchase_id, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddShortNameToTracks < ActiveRecord::Migration
class AddShortNameToTracks < ActiveRecord::Migration[4.2]
class TmpProgram < ActiveRecord::Base
self.table_name = 'programs'
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddTicketLayoutToConferences < ActiveRecord::Migration
class AddTicketLayoutToConferences < ActiveRecord::Migration[4.2]
def change
add_column :conferences, :ticket_layout, :integer, default: 0
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration
class AddStateCfpActiveAndSubmitterReferenceToTracks < ActiveRecord::Migration[4.2]
def change
add_column :tracks, :state, :string
add_column :tracks, :cfp_active, :boolean

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateTicketScannings < ActiveRecord::Migration
class CreateTicketScannings < ActiveRecord::Migration[4.2]
def change
create_table :ticket_scannings do |t|
t.integer :physical_ticket_id, null: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddRoomAndDatesToTracks < ActiveRecord::Migration
class AddRoomAndDatesToTracks < ActiveRecord::Migration[4.2]
def change
add_reference :tracks, :room, index: true, foreign_key: true
add_column :tracks, :start_date, :date

View file

@ -1,11 +1,13 @@
# frozen_string_literal: true
class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration
class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration[4.2]
class TmpTrack < ActiveRecord::Base
self.table_name = 'tracks'
end
def change
TmpTrack.reset_column_information
TmpTrack.where(state: nil).each do |track|
track.state = 'confirmed'
track.save!

View file

@ -1,16 +1,18 @@
# frozen_string_literal: true
class MakeTrackCfpActiveNotNull < ActiveRecord::Migration
class MakeTrackCfpActiveNotNull < ActiveRecord::Migration[4.2]
class TmpTrack < ActiveRecord::Base
self.table_name = 'tracks'
end
def change
TmpTrack.reset_column_information
TmpTrack.where(cfp_active: nil).each do |track|
track.cfp_active = true
track.save!
end
change_column_null :tracks, :cfp_active, false
change_column :tracks, :cfp_active, :boolean, null: false, default: false
end
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexToPhysicalTickets < ActiveRecord::Migration
class AddIndexToPhysicalTickets < ActiveRecord::Migration[4.2]
def change
add_column :physical_tickets, :token, :string
add_index :physical_tickets, :token, unique: true

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddCustomDomainToConferences < ActiveRecord::Migration
class AddCustomDomainToConferences < ActiveRecord::Migration[4.2]
def change
add_column :conferences, :custom_domain, :string
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddRelevanceToTracks < ActiveRecord::Migration
class AddRelevanceToTracks < ActiveRecord::Migration[4.2]
def change
add_column :tracks, :relevance, :text
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIncludeBoothsToSplashpages < ActiveRecord::Migration
class AddIncludeBoothsToSplashpages < ActiveRecord::Migration[4.2]
def change
add_column :splashpages, :include_booths, :boolean
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddBoothLimitToConferences < ActiveRecord::Migration
class AddBoothLimitToConferences < ActiveRecord::Migration[4.2]
def change
add_column :conferences, :booth_limit, :integer, default: 0
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddBoothsToEmailSettings < ActiveRecord::Migration
class AddBoothsToEmailSettings < ActiveRecord::Migration[4.2]
def change
add_column :email_settings, :send_on_booths_acceptance, :boolean, default: false
add_column :email_settings, :booths_acceptance_subject, :string

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddRegistrationTicketToTickets < ActiveRecord::Migration
class AddRegistrationTicketToTickets < ActiveRecord::Migration[4.2]
def change
add_column :tickets, :registration_ticket, :boolean, default: false
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddTrackReferenceToSchedule < ActiveRecord::Migration
class AddTrackReferenceToSchedule < ActiveRecord::Migration[4.2]
def change
add_reference :schedules, :track, index: true, foreign_key: true
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddSelectedScheduleToTracks < ActiveRecord::Migration
class AddSelectedScheduleToTracks < ActiveRecord::Migration[4.2]
def change
add_column :tracks, :selected_schedule_id, :integer
add_index :tracks, :selected_schedule_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddDescriptionToCfps < ActiveRecord::Migration
class AddDescriptionToCfps < ActiveRecord::Migration[4.2]
def change
add_column :cfps, :description, :text
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddAmountPaidToTicketPurchases < ActiveRecord::Migration
class AddAmountPaidToTicketPurchases < ActiveRecord::Migration[4.2]
def change
add_column :ticket_purchases, :amount_paid, :float, default: 0
end

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true
class RebuildConferencePictures < ActiveRecord::Migration
class RebuildConferencePictures < ActiveRecord::Migration[5.0]
def up
Conference.all.each do |conference|
Conference.where.not(picture: nil).each do |conference|
conference.picture.recreate_versions!
end
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddMastodonToContact < ActiveRecord::Migration
class AddMastodonToContact < ActiveRecord::Migration[5.0]
def change
add_column :contacts, :mastodon, :string
end

View file

@ -0,0 +1,35 @@
class AddOrganizationToVersions < ActiveRecord::Migration[5.2]
def up
add_reference :versions, :organization
deconflate
end
def down
conflate
remove_reference :versions, :organization
end
private
def conflate
say 'conflate'
PaperTrail::Version.where.not(organization_id: nil).each do |version|
version.update_attributes conference_id: version.organization_id
end
end
def deconflate
say 'deconflate'
PaperTrail::Version.where.not(conference_id: nil).where(item_type: %[Role UsersRole]).each do |version|
id = version.conference_id
if Organization.exists?(id)
raise "version #{version.id} conflates organization #{id} with conference #{id}" if Conference.exists?(id)
version.update_attributes conference_id: nil, organization_id: id
end
end
end
end

View file

@ -10,10 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_12_29_233811) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
ActiveRecord::Schema.define(version: 2020_03_31_214534) do
create_table "answers", force: :cascade do |t|
t.string "title"
@ -641,7 +638,9 @@ ActiveRecord::Schema.define(version: 2018_12_29_233811) do
t.text "object_changes"
t.datetime "created_at"
t.integer "conference_id"
t.integer "organization_id"
t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
t.index ["organization_id"], name: "index_versions_on_organization_id"
end
create_table "votes", force: :cascade do |t|