Properly define migrations

This commit is contained in:
Eric Schultz 2019-11-14 14:47:53 -06:00
parent 2a7f6d035c
commit a8fa708913
52 changed files with 52 additions and 52 deletions

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexesForPaymentAndSupporterQueries < ActiveRecord::Migration
class AddIndexesForPaymentAndSupporterQueries < ActiveRecord::Migration[4.2]
def up
Qx.transaction do
Qx.execute(%(

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class DropAllCruft < ActiveRecord::Migration
class DropAllCruft < ActiveRecord::Migration[4.2]
def change
Qx.execute(%(
DROP FUNCTION IF EXISTS update_payment_donations_search_vectors();

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class NormalizeStartAndEndDatetimesForEventsAndCampaigns < ActiveRecord::Migration
class NormalizeStartAndEndDatetimesForEventsAndCampaigns < ActiveRecord::Migration[4.2]
def up
add_column :events, :start_datetime, :datetime
add_column :events, :end_datetime, :datetime

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddDonationCampaignIdIndex < ActiveRecord::Migration
class AddDonationCampaignIdIndex < ActiveRecord::Migration[4.2]
def up
Qx.execute(%(
CREATE INDEX IF NOT EXISTS donations_campaign_id ON donations (campaign_id);

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddTheTagJoinsBackupTable < ActiveRecord::Migration
class AddTheTagJoinsBackupTable < ActiveRecord::Migration[4.2]
def up
create_table :tag_joins_backup do |t|
t.integer 'tag_master_id'

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexForTagJoinsAndAddConstraint < ActiveRecord::Migration
class AddIndexForTagJoinsAndAddConstraint < ActiveRecord::Migration[4.2]
def up
ids = DeleteTagJoins.find_multiple_tag_joins
DeleteTagJoins.copy_and_delete(ids)

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddCustomFieldJoinsBackupTable < ActiveRecord::Migration
class AddCustomFieldJoinsBackupTable < ActiveRecord::Migration[4.2]
def change
create_table :custom_field_joins_backup do |t|
t.integer 'custom_field_master_id'

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexForCustomFieldJoinAndSupporters < ActiveRecord::Migration
class AddIndexForCustomFieldJoinAndSupporters < ActiveRecord::Migration[4.2]
def up
ids = DeleteCustomFieldJoins.find_multiple_custom_field_joins
DeleteCustomFieldJoins.copy_and_delete(ids)

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddInactiveToCard < ActiveRecord::Migration
class AddInactiveToCard < ActiveRecord::Migration[4.2]
class Card < ActiveRecord::Base
attr_accessible :inactive
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CreateExports < ActiveRecord::Migration
class CreateExports < ActiveRecord::Migration[4.2]
def change
create_table :exports do |t|
t.integer :user_id

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CreateMiscellaneousNpInfos < ActiveRecord::Migration
class CreateMiscellaneousNpInfos < ActiveRecord::Migration[4.2]
def change
create_table :miscellaneous_np_infos do |t|
t.string :donate_again_url

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddCurrencyToNonprofit < ActiveRecord::Migration
class AddCurrencyToNonprofit < ActiveRecord::Migration[4.2]
def change
add_column :nonprofits, :currency, :string, default: Settings.intntl.currencies[0]
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddChangeAmountMessageToMiscellaneousNpInfos < ActiveRecord::Migration
class AddChangeAmountMessageToMiscellaneousNpInfos < ActiveRecord::Migration[4.2]
def change
add_column :miscellaneous_np_infos, :change_amount_message, :text
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddFirstAndLastNameToSupporter < ActiveRecord::Migration
class AddFirstAndLastNameToSupporter < ActiveRecord::Migration[4.2]
def change
add_column :supporters, :first_name, :string
add_column :supporters, :last_name, :string

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddTracking < ActiveRecord::Migration
class AddTracking < ActiveRecord::Migration[4.2]
def change
create_table :trackings do |t|
t.column :utm_campaign, :string, unique: true

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddQueuedForImportAtToDonation < ActiveRecord::Migration
class AddQueuedForImportAtToDonation < ActiveRecord::Migration[4.2]
def change
add_column :donations, :queued_for_import_at, :datetime, default: nil
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddDirectDebitDetail < ActiveRecord::Migration
class AddDirectDebitDetail < ActiveRecord::Migration[4.2]
def change
create_table :direct_debit_details do |t|
t.string :iban

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddUtmContentToTrackings < ActiveRecord::Migration
class AddUtmContentToTrackings < ActiveRecord::Migration[4.2]
def change
add_column :trackings, :utm_content, :string, unique: true
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddLocaleToSupporters < ActiveRecord::Migration
class AddLocaleToSupporters < ActiveRecord::Migration[4.2]
def change
add_column :supporters, :locale, :string
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddPaymentProviderToDonations < ActiveRecord::Migration
class AddPaymentProviderToDonations < ActiveRecord::Migration[4.2]
def change
add_column :donations, :payment_provider, :string
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddDirectDebitDetailToCharges < ActiveRecord::Migration
class AddDirectDebitDetailToCharges < ActiveRecord::Migration[4.2]
def change
add_column :charges, :direct_debit_detail_id, :integer
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddExternalIdentifierToCampaign < ActiveRecord::Migration
class AddExternalIdentifierToCampaign < ActiveRecord::Migration[4.2]
def change
add_column :campaigns, :external_identifier, :string
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexToCampaignGifts < ActiveRecord::Migration
class AddIndexToCampaignGifts < ActiveRecord::Migration[4.2]
def change
add_index :campaign_gifts, :campaign_gift_option_id
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexToActivities < ActiveRecord::Migration
class AddIndexToActivities < ActiveRecord::Migration[4.2]
def change
add_index :activities, :supporter_id
add_index :activities, :nonprofit_id

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class ModifySupportersNameIndex < ActiveRecord::Migration
class ModifySupportersNameIndex < ActiveRecord::Migration[4.2]
def up
rename_index :supporters, :supporters_name, :supporters_lower_name
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddSupportersNameIndex < ActiveRecord::Migration
class AddSupportersNameIndex < ActiveRecord::Migration[4.2]
def change
add_index :supporters, :name
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddChargesPaymentIdIndex < ActiveRecord::Migration
class AddChargesPaymentIdIndex < ActiveRecord::Migration[4.2]
def change
add_index :charges, :payment_id
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddIndexesForSupporterDeletedAndImport < ActiveRecord::Migration
class AddIndexesForSupporterDeletedAndImport < ActiveRecord::Migration[4.2]
def change
add_index :supporters, :deleted
add_index :supporters, :import_id

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CreatePaymentImports < ActiveRecord::Migration
class CreatePaymentImports < ActiveRecord::Migration[4.2]
def change
create_table :payment_imports do |t|
t.references :user

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CreateDonationsPaymentImportsJoinTable < ActiveRecord::Migration
class CreateDonationsPaymentImportsJoinTable < ActiveRecord::Migration[4.2]
def change
create_table :donations_payment_imports, id: false do |t|
t.references :donation

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class RemoveUnusedMetadata < ActiveRecord::Migration
class RemoveUnusedMetadata < ActiveRecord::Migration[4.2]
TABLES = %i[
campaign_gift_options
campaign_gifts

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class RemoveRecurringDonationEventId < ActiveRecord::Migration
class RemoveRecurringDonationEventId < ActiveRecord::Migration[4.2]
def change
change_table :recurring_donations do |t|
t.remove :event_id

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class CreateSourceTokens < ActiveRecord::Migration
class CreateSourceTokens < ActiveRecord::Migration[4.2]
def change
create_table :source_tokens, id: false do |t|
t.column :token, 'uuid', primary_key: true, null: false

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AddCardTokenToTicket < ActiveRecord::Migration
class AddCardTokenToTicket < ActiveRecord::Migration[4.2]
def up
add_column :tickets, :source_token_id, 'uuid'
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexesToSupporterNotes < ActiveRecord::Migration
class AddIndexesToSupporterNotes < ActiveRecord::Migration[4.2]
def change
add_index :supporter_notes, :supporter_id, order: { supporter_id: :asc }
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class ChangeDddSupporterToHolder < ActiveRecord::Migration
class ChangeDddSupporterToHolder < ActiveRecord::Migration[4.2]
def change
rename_column :direct_debit_details, :supporter_id, :holder_id
end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class RemoveArticles < ActiveRecord::Migration
class RemoveArticles < ActiveRecord::Migration[4.2]
def up
drop_table :articles
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexToSupporterIdOnTickets < ActiveRecord::Migration
class AddIndexToSupporterIdOnTickets < ActiveRecord::Migration[4.2]
def change
add_index :tickets, :supporter_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexToEventIdOnDonationsAndEvents < ActiveRecord::Migration
class AddIndexToEventIdOnDonationsAndEvents < ActiveRecord::Migration[4.2]
def change
add_index :tickets, :event_id
add_index :donations, :event_id

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddParentCampaignIdToCampaigns < ActiveRecord::Migration
class AddParentCampaignIdToCampaigns < ActiveRecord::Migration[4.2]
def change
add_column :campaigns, :parent_campaign_id, :integer
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddReasonForSupportingToCampaigns < ActiveRecord::Migration
class AddReasonForSupportingToCampaigns < ActiveRecord::Migration[4.2]
def change
add_column :campaigns, :reason_for_supporting, :text
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddDefaultReasonForSupportingToCampaigns < ActiveRecord::Migration
class AddDefaultReasonForSupportingToCampaigns < ActiveRecord::Migration[4.2]
def change
add_column :campaigns, :default_reason_for_supporting, :text
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddBannerImageToCampaigns < ActiveRecord::Migration
class AddBannerImageToCampaigns < ActiveRecord::Migration[4.2]
def change
add_column :campaigns, :banner_image, :string
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddChargeIdIndexes < ActiveRecord::Migration
class AddChargeIdIndexes < ActiveRecord::Migration[4.2]
def change
add_index :refunds, :charge_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddPaymentIdToTickets < ActiveRecord::Migration
class AddPaymentIdToTickets < ActiveRecord::Migration[4.2]
def change
add_index :tickets, :payment_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexesToRefunds < ActiveRecord::Migration
class AddIndexesToRefunds < ActiveRecord::Migration[4.2]
def change
add_index :refunds, :payment_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CorrectDedications < ActiveRecord::Migration
class CorrectDedications < ActiveRecord::Migration[4.2]
def up
execute <<~SQL
create or replace function is_valid_json(p_json text)

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CorrectDedicationContacts < ActiveRecord::Migration
class CorrectDedicationContacts < ActiveRecord::Migration[4.2]
def up
json_dedications = Qx.select('id', 'dedication').from(:donations)
.where("dedication IS NOT NULL AND dedication != ''")

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexParentCampaignIdToCampaign < ActiveRecord::Migration
class AddIndexParentCampaignIdToCampaign < ActiveRecord::Migration[4.2]
def change
add_index :campaigns, :parent_campaign_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexesToRecurringDonations < ActiveRecord::Migration
class AddIndexesToRecurringDonations < ActiveRecord::Migration[4.2]
def change
add_index :recurring_donations, :donation_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddDonationIdIndexToCampaignGifts < ActiveRecord::Migration
class AddDonationIdIndexToCampaignGifts < ActiveRecord::Migration[4.2]
def change
add_index :campaign_gifts, :donation_id
end

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AddIndexToPaymentsCreatedAt < ActiveRecord::Migration
class AddIndexToPaymentsCreatedAt < ActiveRecord::Migration[4.2]
def change
add_index :payments, :created_at
end