From 29549a5b5794e0ce1b2a36357fc1e4cd9422e3cb Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 30 Apr 2020 15:47:08 -0500 Subject: [PATCH] Remove v1 migrations --- ...dexes_for_payment_and_supporter_queries.rb | 58 ---- db/migrate/20170307223525_drop_all_cruft.rb | 296 ------------------ ..._end_datetimes_for_events_and_campaigns.rb | 42 --- ...22203228_add_donation_campaign_id_index.rb | 18 -- ...05180556_add_the_tag_joins_backup_table.rb | 18 -- ..._index_for_tag_joins_and_add_constraint.rb | 15 - ...558_add_custom_field_joins_backup_table.rb | 14 - ...ex_for_custom_field_join_and_supporters.rb | 15 - .../20170808180559_add_inactive_to_card.rb | 15 - db/migrate/20170818201127_create_exports.rb | 22 -- ...002160808_create_miscellaneous_np_infos.rb | 12 - ...0171002164402_add_currency_to_nonprofit.rb | 8 - ...mount_message_to_miscellaneous_np_infos.rb | 8 - ...37_add_first_and_last_name_to_supporter.rb | 9 - db/migrate/20171016181942_add_tracking.rb | 14 - ...06_add_queued_for_import_at_to_donation.rb | 8 - .../20171026102139_add_direct_debit_detail.rb | 21 -- ...1129215957_add_utm_content_to_trackings.rb | 8 - ...20171130182254_add_locale_to_supporters.rb | 8 - ...93955_add_payment_provider_to_donations.rb | 8 - ...3317_add_direct_debit_detail_to_charges.rb | 8 - ...229_add_external_identifier_to_campaign.rb | 8 - ...71207191435_add_index_to_campaign_gifts.rb | 8 - .../20171207191712_add_index_to_activities.rb | 9 - ...1207200746_modify_supporters_name_index.rb | 12 - ...0171207200950_add_supporters_name_index.rb | 8 - ...1207210431_add_charges_payment_id_index.rb | 8 - ...ndexes_for_supporter_deleted_and_import.rb | 9 - .../20180119215653_create_payment_imports.rb | 13 - ...te_donations_payment_imports_join_table.rb | 11 - .../20180202181929_remove_unused_metadata.rb | 48 --- ...1755_remove_recurring_donation_event_id.rb | 10 - .../20180214124311_create_source_tokens.rb | 20 -- ...20180215124311_add_card_token_to_ticket.rb | 12 - ...16064311_add_indexes_to_supporter_notes.rb | 7 - ...16124311_change_ddd_supporter_to_holder.rb | 8 - db/migrate/20180217124311_remove_articles.rb | 10 - ...49_add_index_to_supporter_id_on_tickets.rb | 7 - ...dex_to_event_id_on_donations_and_events.rb | 8 - ...401_add_parent_campaign_id_to_campaigns.rb | 7 - ..._add_reason_for_supporting_to_campaigns.rb | 7 - ...ault_reason_for_supporting_to_campaigns.rb | 7 - ...703165405_add_banner_image_to_campaigns.rb | 7 - .../20180713213748_add_charge_id_indexes.rb | 7 - ...0180713215825_add_payment_id_to_tickets.rb | 7 - .../20180713220028_add_indexes_to_refunds.rb | 7 - .../20181002160627_correct_dedications.rb | 30 -- ...81003212559_correct_dedication_contacts.rb | 55 ---- ...dd_index_parent_campaign_id_to_campaign.rb | 7 - ...1143_add_indexes_to_recurring_donations.rb | 7 - ...add_donation_id_index_to_campaign_gifts.rb | 7 - ...224030_add_index_to_payments_created_at.rb | 7 - 52 files changed, 1003 deletions(-) delete mode 100644 db/migrate/20170307222633_add_indexes_for_payment_and_supporter_queries.rb delete mode 100644 db/migrate/20170307223525_drop_all_cruft.rb delete mode 100644 db/migrate/20170314193744_normalize_start_and_end_datetimes_for_events_and_campaigns.rb delete mode 100644 db/migrate/20170322203228_add_donation_campaign_id_index.rb delete mode 100644 db/migrate/20170805180556_add_the_tag_joins_backup_table.rb delete mode 100644 db/migrate/20170805180557_add_index_for_tag_joins_and_add_constraint.rb delete mode 100644 db/migrate/20170805180558_add_custom_field_joins_backup_table.rb delete mode 100644 db/migrate/20170805180559_add_index_for_custom_field_join_and_supporters.rb delete mode 100644 db/migrate/20170808180559_add_inactive_to_card.rb delete mode 100644 db/migrate/20170818201127_create_exports.rb delete mode 100644 db/migrate/20171002160808_create_miscellaneous_np_infos.rb delete mode 100644 db/migrate/20171002164402_add_currency_to_nonprofit.rb delete mode 100644 db/migrate/20171004203633_add_change_amount_message_to_miscellaneous_np_infos.rb delete mode 100644 db/migrate/20171010204437_add_first_and_last_name_to_supporter.rb delete mode 100644 db/migrate/20171016181942_add_tracking.rb delete mode 100644 db/migrate/20171024133806_add_queued_for_import_at_to_donation.rb delete mode 100644 db/migrate/20171026102139_add_direct_debit_detail.rb delete mode 100644 db/migrate/20171129215957_add_utm_content_to_trackings.rb delete mode 100644 db/migrate/20171130182254_add_locale_to_supporters.rb delete mode 100644 db/migrate/20171130193955_add_payment_provider_to_donations.rb delete mode 100644 db/migrate/20171206113317_add_direct_debit_detail_to_charges.rb delete mode 100644 db/migrate/20171207114229_add_external_identifier_to_campaign.rb delete mode 100644 db/migrate/20171207191435_add_index_to_campaign_gifts.rb delete mode 100644 db/migrate/20171207191712_add_index_to_activities.rb delete mode 100644 db/migrate/20171207200746_modify_supporters_name_index.rb delete mode 100644 db/migrate/20171207200950_add_supporters_name_index.rb delete mode 100644 db/migrate/20171207210431_add_charges_payment_id_index.rb delete mode 100644 db/migrate/20180106024119_add_indexes_for_supporter_deleted_and_import.rb delete mode 100644 db/migrate/20180119215653_create_payment_imports.rb delete mode 100644 db/migrate/20180119215913_create_donations_payment_imports_join_table.rb delete mode 100644 db/migrate/20180202181929_remove_unused_metadata.rb delete mode 100644 db/migrate/20180213191755_remove_recurring_donation_event_id.rb delete mode 100644 db/migrate/20180214124311_create_source_tokens.rb delete mode 100644 db/migrate/20180215124311_add_card_token_to_ticket.rb delete mode 100644 db/migrate/20180216064311_add_indexes_to_supporter_notes.rb delete mode 100644 db/migrate/20180216124311_change_ddd_supporter_to_holder.rb delete mode 100644 db/migrate/20180217124311_remove_articles.rb delete mode 100644 db/migrate/20180608205049_add_index_to_supporter_id_on_tickets.rb delete mode 100644 db/migrate/20180608212658_add_index_to_event_id_on_donations_and_events.rb delete mode 100644 db/migrate/20180703165401_add_parent_campaign_id_to_campaigns.rb delete mode 100644 db/migrate/20180703165402_add_reason_for_supporting_to_campaigns.rb delete mode 100644 db/migrate/20180703165404_add_default_reason_for_supporting_to_campaigns.rb delete mode 100644 db/migrate/20180703165405_add_banner_image_to_campaigns.rb delete mode 100644 db/migrate/20180713213748_add_charge_id_indexes.rb delete mode 100644 db/migrate/20180713215825_add_payment_id_to_tickets.rb delete mode 100644 db/migrate/20180713220028_add_indexes_to_refunds.rb delete mode 100644 db/migrate/20181002160627_correct_dedications.rb delete mode 100644 db/migrate/20181003212559_correct_dedication_contacts.rb delete mode 100644 db/migrate/20181120182105_add_index_parent_campaign_id_to_campaign.rb delete mode 100644 db/migrate/20181128221143_add_indexes_to_recurring_donations.rb delete mode 100644 db/migrate/20181129205652_add_donation_id_index_to_campaign_gifts.rb delete mode 100644 db/migrate/20181129224030_add_index_to_payments_created_at.rb diff --git a/db/migrate/20170307222633_add_indexes_for_payment_and_supporter_queries.rb b/db/migrate/20170307222633_add_indexes_for_payment_and_supporter_queries.rb deleted file mode 100644 index 75807335..00000000 --- a/db/migrate/20170307222633_add_indexes_for_payment_and_supporter_queries.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexesForPaymentAndSupporterQueries < ActiveRecord::Migration[4.2] - def up - Qx.transaction do - Qx.execute(%( - CREATE INDEX IF NOT EXISTS payments_date ON payments (date); - CREATE INDEX IF NOT EXISTS payments_gross_amount ON payments (gross_amount); - CREATE INDEX IF NOT EXISTS payments_kind ON payments (kind); - CREATE INDEX IF NOT EXISTS payments_towards ON payments (lower(towards)); - CREATE INDEX IF NOT EXISTS payments_donation_id ON payments (donation_id); - CREATE INDEX IF NOT EXISTS payments_supporter_id ON payments (supporter_id); - CREATE INDEX IF NOT EXISTS payments_nonprofit_id ON payments (nonprofit_id); - - CREATE INDEX IF NOT EXISTS supporters_created_at ON supporters (created_at) WHERE deleted != true; - CREATE INDEX IF NOT EXISTS supporters_name ON supporters (lower(name)) WHERE deleted != true; - CREATE INDEX IF NOT EXISTS supporters_email ON supporters (lower(email)) WHERE deleted != true; - CREATE INDEX IF NOT EXISTS supporters_nonprofit_id ON supporters (nonprofit_id) WHERE deleted != true; - - CREATE INDEX IF NOT EXISTS donations_amount ON donations USING btree (amount); - CREATE INDEX IF NOT EXISTS donations_designation ON donations USING btree (lower(designation)); - CREATE INDEX IF NOT EXISTS donations_supporter_id ON donations USING btree (supporter_id); - - CREATE INDEX IF NOT EXISTS tag_joins_supporter_id ON tag_joins (supporter_id); - CREATE INDEX IF NOT EXISTS tag_joins_tag_master_id ON tag_joins (tag_master_id); - - CREATE INDEX IF NOT EXISTS custom_field_joins_custom_field_master_id ON custom_field_joins (custom_field_master_id); - )) - end - end - - def down - Qx.execute(%( - DROP INDEX IF EXISTS payments_date; - DROP INDEX IF EXISTS payments_gross_amount; - DROP INDEX IF EXISTS payments_kind; - DROP INDEX IF EXISTS payments_towards; - DROP INDEX IF EXISTS payments_supporter_id; - DROP INDEX IF EXISTS payments_nonprofit_id; - - DROP INDEX IF EXISTS supporters_created_at; - DROP INDEX IF EXISTS supporters_name; - DROP INDEX IF EXISTS supporters_email; - DROP INDEX IF EXISTS supporters_nonprofit_id; - DROP INDEX IF EXISTS supporters_donation_id; - - DROP INDEX IF EXISTS donations_amount; - DROP INDEX IF EXISTS donations_designation; - DROP INDEX IF EXISTS donations_supporter_id; - - DROP INDEX IF EXISTS tag_joins_supporter_id; - DROP INDEX IF EXISTS tag_joins_tag_master_id; - - DROP INDEX IF EXISTS custom_field_joins_custom_field_master_id; - )) - end -end diff --git a/db/migrate/20170307223525_drop_all_cruft.rb b/db/migrate/20170307223525_drop_all_cruft.rb deleted file mode 100644 index 472b3b38..00000000 --- a/db/migrate/20170307223525_drop_all_cruft.rb +++ /dev/null @@ -1,296 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class DropAllCruft < ActiveRecord::Migration[4.2] - def change - Qx.execute(%( - DROP FUNCTION IF EXISTS update_payment_donations_search_vectors(); - DROP FUNCTION IF EXISTS supporters_insert_trigger(); - DROP FUNCTION IF EXISTS update_payment_search_vectors(); - DROP FUNCTION IF EXISTS update_payment_supporters_search_vectors(); - DROP FUNCTION IF EXISTS update_supporter_search_vectors(); - DROP TABLE IF EXISTS billing_customers; - DROP TABLE IF EXISTS coupons; - DROP TABLE IF EXISTS dedications; - DROP TABLE IF EXISTS email_drafts; - DROP TABLE IF EXISTS image_points; - DROP TABLE IF EXISTS pg_search_documents; - DROP TABLE IF EXISTS prospect_events; - DROP TABLE IF EXISTS prospect_visit_params; - DROP TABLE IF EXISTS prospect_visits; - DROP TABLE IF EXISTS prospects; - DROP TABLE IF EXISTS recommendations; - )) - end - - def down - Qx.execute(%( -CREATE FUNCTION update_payment_donations_search_vectors() RETURNS trigger - LANGUAGE plpgsql - AS $$ BEGIN - IF pg_trigger_depth() <> 1 THEN RETURN new; END IF; - UPDATE payments - SET search_vectors=to_tsvector('english', data.search_blob) - FROM ( -SELECT payments.id, concat_ws(' ' - , payments.gross_amount - , payments.kind - , payments.towards - , supporters.name - , supporters.organization - , supporters.email - , supporters.city - , supporters.state_code - , donations.designation - , donations.dedication - ) AS search_blob -FROM payments -LEFT OUTER JOIN supporters - ON payments.supporter_id=supporters.id -LEFT OUTER JOIN donations - ON payments.donation_id=donations.id -WHERE (payments.donation_id=NEW.id)) AS data - WHERE data.id=payments.id; - RETURN new; - END $$; - )) - - Qx.execute(%( -CREATE FUNCTION supporters_insert_trigger() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - INSERT INTO supporters_active VALUES(NEW.*); - RETURN NULL; - END; $$; -)) - - Qx.execute(%( -CREATE FUNCTION update_payment_search_vectors() RETURNS trigger - LANGUAGE plpgsql - AS $$ BEGIN - IF pg_trigger_depth() <> 1 THEN RETURN new; END IF; - UPDATE payments - SET search_vectors=to_tsvector('english', data.search_blob) - FROM ( -SELECT payments.id, concat_ws(' ' - , payments.gross_amount - , payments.kind - , payments.towards - , supporters.name - , supporters.organization - , supporters.email - , supporters.city - , supporters.state_code - , donations.designation - , donations.dedication - ) AS search_blob -FROM payments -LEFT OUTER JOIN supporters - ON payments.supporter_id=supporters.id -LEFT OUTER JOIN donations - ON payments.donation_id=donations.id -WHERE (payments.id=NEW.id)) AS data - WHERE data.id=payments.id; - RETURN new; - END $$; - - )) - - Qx.execute(%( -CREATE FUNCTION update_payment_supporters_search_vectors() RETURNS trigger - LANGUAGE plpgsql - AS $$ BEGIN - IF pg_trigger_depth() <> 1 THEN RETURN new; END IF; - UPDATE payments - SET search_vectors=to_tsvector('english', data.search_blob) - FROM ( -SELECT payments.id, concat_ws(' ' - , payments.gross_amount - , payments.kind - , payments.towards - , supporters.name - , supporters.organization - , supporters.email - , supporters.city - , supporters.state_code - , donations.designation - , donations.dedication - ) AS search_blob -FROM payments -LEFT OUTER JOIN supporters - ON payments.supporter_id=supporters.id -LEFT OUTER JOIN donations - ON payments.donation_id=donations.id -WHERE (payments.supporter_id=NEW.id)) AS data - WHERE data.id=payments.id; - RETURN new; - END $$; - )) - - Qx.execute(%( -CREATE FUNCTION update_supporter_search_vectors() RETURNS trigger - LANGUAGE plpgsql - AS $$ BEGIN - IF pg_trigger_depth() <> 1 THEN RETURN new; END IF; - UPDATE supporters - SET search_vectors=to_tsvector('english', data.search_blob) - FROM ( -SELECT supporters.id, concat_ws(' ' - , custom_field_joins.value - , supporters.name - , supporters.organization - , supporters.id - , supporters.email - , supporters.city - , supporters.state_code - , donations.designation - , donations.dedication - , payments.kind - , payments.towards - ) AS search_blob -FROM supporters -LEFT OUTER JOIN payments - ON payments.supporter_id=supporters.id -LEFT OUTER JOIN donations - ON donations.supporter_id=supporters.id -LEFT OUTER JOIN ( -SELECT string_agg(value::text, ' ') AS value, supporter_id -FROM custom_field_joins -GROUP BY supporter_id) AS custom_field_joins - ON custom_field_joins.supporter_id=supporters.id -WHERE (supporters.id=NEW.id)) AS data - WHERE data.id=supporters.id; - RETURN new; - END $$; - )) - - Qx.execute(%( -CREATE TABLE billing_customers ( - id integer NOT NULL, - card_name character varying(255), - stripe_customer_id character varying(255), - nonprofit_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - - )) - - Qx.execute(%( -CREATE TABLE coupons ( - id integer NOT NULL, - name character varying(255), - paid boolean, - victim_np_id integer, - nonprofit_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - - Qx.execute(%( -CREATE TABLE dedications ( - id integer NOT NULL, - donation_id integer, - supporter_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - - Qx.execute(%( -CREATE TABLE email_drafts ( - id integer NOT NULL, - nonprofit_id integer, - name character varying(255), - value text, - deleted boolean, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - - Qx.execute(%( -CREATE TABLE image_points ( - id integer NOT NULL, - image_name character varying(255), - host_id integer, - host_type character varying(255), - x double precision, - y double precision, - preview_left character varying(255), - preview_top character varying(255), - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - - Qx.execute(%( -CREATE TABLE pg_search_documents ( - id integer NOT NULL, - content text, - searchable_id integer, - searchable_type character varying(255), - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - - )) - - Qx.execute(%( -CREATE TABLE prospect_events ( - id integer NOT NULL, - event character varying(255), - prospect_visit_id integer, - prospect_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - - Qx.execute(%( -CREATE TABLE prospect_visit_params ( - id integer NOT NULL, - key character varying(255), - val character varying(255), - prospect_visit_id integer -); - )) - - Qx.execute(%( -CREATE TABLE prospect_visits ( - id integer NOT NULL, - pathname text, - prospect_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); -)) - - Qx.execute(%( - CREATE TABLE prospects ( - id integer NOT NULL, - ip_address character varying(255), - referrer_url text, - user_id integer, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - email character varying(255), - session_id character varying(255), - cookie_id character varying(255) -); - )) - - Qx.execute(%( -CREATE TABLE recommendations ( - id integer NOT NULL, - nonprofit_id integer, - profile_id integer, - content text, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); - )) - end -end diff --git a/db/migrate/20170314193744_normalize_start_and_end_datetimes_for_events_and_campaigns.rb b/db/migrate/20170314193744_normalize_start_and_end_datetimes_for_events_and_campaigns.rb deleted file mode 100644 index 4a91abb5..00000000 --- a/db/migrate/20170314193744_normalize_start_and_end_datetimes_for_events_and_campaigns.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class NormalizeStartAndEndDatetimesForEventsAndCampaigns < ActiveRecord::Migration[4.2] - def up - add_column :events, :start_datetime, :datetime - add_column :events, :end_datetime, :datetime - add_column :campaigns, :end_datetime, :datetime - Qx.update(:events) - .set(%(start_datetime = ("date" + start_time), end_datetime = ("date" + end_time))) - .where("created_at > '2012-01-01'") - .execute - Qx.update(:campaigns) - .set('end_datetime = (expiration + end_time)') - .where("created_at > '2012-01-01'") - .execute - remove_column :events, :end_time - remove_column :events, :start_time - remove_column :events, :date - remove_column :campaigns, :expiration - remove_column :campaigns, :end_time - end - - def down - add_column :events, :end_time, :time - add_column :events, :start_time, :time - add_column :events, :date, :date - add_column :campaigns, :expiration, :date - add_column :campaigns, :end_time, :time - Qx.update(:events) - .set(%(end_time = end_datetime::time, start_time = start_datetime::time, "date" = start_datetime::date)) - .where("created_at > '2012-01-01'") - .execute - Qx.update(:campaigns) - .set('end_time = end_datetime::time, expiration = end_datetime::date') - .where("created_at > '2012-01-01'") - .execute - remove_column :events, :start_datetime - remove_column :events, :end_datetime - remove_column :campaigns, :end_datetime - end -end diff --git a/db/migrate/20170322203228_add_donation_campaign_id_index.rb b/db/migrate/20170322203228_add_donation_campaign_id_index.rb deleted file mode 100644 index a534ccc8..00000000 --- a/db/migrate/20170322203228_add_donation_campaign_id_index.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddDonationCampaignIdIndex < ActiveRecord::Migration[4.2] - def up - Qx.execute(%( - CREATE INDEX IF NOT EXISTS donations_campaign_id ON donations (campaign_id); - CREATE INDEX IF NOT EXISTS donations_event_id ON donations (event_id); - )) - end - - def down - Qx.execute(%( - DROP INDEX IF EXISTS donations_campaign_id; - DROP INDEX IF EXISTS donations_event_id; - )) - end -end diff --git a/db/migrate/20170805180556_add_the_tag_joins_backup_table.rb b/db/migrate/20170805180556_add_the_tag_joins_backup_table.rb deleted file mode 100644 index a4114f7d..00000000 --- a/db/migrate/20170805180556_add_the_tag_joins_backup_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddTheTagJoinsBackupTable < ActiveRecord::Migration[4.2] - def up - create_table :tag_joins_backup do |t| - t.integer 'tag_master_id' - t.integer 'supporter_id' - t.datetime 'created_at' - t.datetime 'updated_at' - t.text 'metadata' - end - end - - def down - drop_table :tag_joins_backup - end -end diff --git a/db/migrate/20170805180557_add_index_for_tag_joins_and_add_constraint.rb b/db/migrate/20170805180557_add_index_for_tag_joins_and_add_constraint.rb deleted file mode 100644 index bc67baf5..00000000 --- a/db/migrate/20170805180557_add_index_for_tag_joins_and_add_constraint.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexForTagJoinsAndAddConstraint < ActiveRecord::Migration[4.2] - def up - ids = DeleteTagJoins.find_multiple_tag_joins - DeleteTagJoins.copy_and_delete(ids) - add_index :tag_joins, %i[tag_master_id supporter_id], unique: true, name: 'tag_join_supporter_unique_idx' - end - - def down - remove_index(:tag_joins, name: 'tag_join_supporter_unique_idx') - DeleteTagJoins.revert - end -end diff --git a/db/migrate/20170805180558_add_custom_field_joins_backup_table.rb b/db/migrate/20170805180558_add_custom_field_joins_backup_table.rb deleted file mode 100644 index e4823e69..00000000 --- a/db/migrate/20170805180558_add_custom_field_joins_backup_table.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddCustomFieldJoinsBackupTable < ActiveRecord::Migration[4.2] - def change - create_table :custom_field_joins_backup do |t| - t.integer 'custom_field_master_id' - t.integer 'supporter_id' - t.text 'metadata' - t.text 'value' - t.timestamps - end - end -end diff --git a/db/migrate/20170805180559_add_index_for_custom_field_join_and_supporters.rb b/db/migrate/20170805180559_add_index_for_custom_field_join_and_supporters.rb deleted file mode 100644 index 95ffa1f8..00000000 --- a/db/migrate/20170805180559_add_index_for_custom_field_join_and_supporters.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexForCustomFieldJoinAndSupporters < ActiveRecord::Migration[4.2] - def up - ids = DeleteCustomFieldJoins.find_multiple_custom_field_joins - DeleteCustomFieldJoins.copy_and_delete(ids) - add_index :custom_field_joins, %i[custom_field_master_id supporter_id], unique: true, name: 'custom_field_join_supporter_unique_idx' - end - - def down - remove_index(:custom_field_joins, name: 'custom_field_join_supporter_unique_idx') - DeleteCustomFieldJoins.revert - end -end diff --git a/db/migrate/20170808180559_add_inactive_to_card.rb b/db/migrate/20170808180559_add_inactive_to_card.rb deleted file mode 100644 index 612af82f..00000000 --- a/db/migrate/20170808180559_add_inactive_to_card.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddInactiveToCard < ActiveRecord::Migration[4.2] - class Card < ActiveRecord::Base - attr_accessible :inactive - end - def change - add_column :cards, :inactive, :boolean - - add_index :cards, %i[id holder_type holder_id inactive] # add index for getting active_card - Card.reset_column_information - Card.update_all(inactive: false) - end -end diff --git a/db/migrate/20170818201127_create_exports.rb b/db/migrate/20170818201127_create_exports.rb deleted file mode 100644 index 2b03c015..00000000 --- a/db/migrate/20170818201127_create_exports.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CreateExports < ActiveRecord::Migration[4.2] - def change - create_table :exports do |t| - t.integer :user_id - t.integer :nonprofit_id - t.string :status - t.string :exception - t.datetime :ended - t.string :export_type - t.string :parameters - t.string :url - - t.timestamps - end - - add_index :exports, :user_id - add_index :exports, :nonprofit_id - end -end diff --git a/db/migrate/20171002160808_create_miscellaneous_np_infos.rb b/db/migrate/20171002160808_create_miscellaneous_np_infos.rb deleted file mode 100644 index 562f7e91..00000000 --- a/db/migrate/20171002160808_create_miscellaneous_np_infos.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CreateMiscellaneousNpInfos < ActiveRecord::Migration[4.2] - def change - create_table :miscellaneous_np_infos do |t| - t.string :donate_again_url - t.belongs_to :nonprofit - t.timestamps - end - end -end diff --git a/db/migrate/20171002164402_add_currency_to_nonprofit.rb b/db/migrate/20171002164402_add_currency_to_nonprofit.rb deleted file mode 100644 index 08c9e79b..00000000 --- a/db/migrate/20171002164402_add_currency_to_nonprofit.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddCurrencyToNonprofit < ActiveRecord::Migration[4.2] - def change - add_column :nonprofits, :currency, :string, default: Settings.intntl.currencies[0] - end -end diff --git a/db/migrate/20171004203633_add_change_amount_message_to_miscellaneous_np_infos.rb b/db/migrate/20171004203633_add_change_amount_message_to_miscellaneous_np_infos.rb deleted file mode 100644 index b50a2823..00000000 --- a/db/migrate/20171004203633_add_change_amount_message_to_miscellaneous_np_infos.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddChangeAmountMessageToMiscellaneousNpInfos < ActiveRecord::Migration[4.2] - def change - add_column :miscellaneous_np_infos, :change_amount_message, :text - end -end diff --git a/db/migrate/20171010204437_add_first_and_last_name_to_supporter.rb b/db/migrate/20171010204437_add_first_and_last_name_to_supporter.rb deleted file mode 100644 index bf990f88..00000000 --- a/db/migrate/20171010204437_add_first_and_last_name_to_supporter.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddFirstAndLastNameToSupporter < ActiveRecord::Migration[4.2] - def change - add_column :supporters, :first_name, :string - add_column :supporters, :last_name, :string - end -end diff --git a/db/migrate/20171016181942_add_tracking.rb b/db/migrate/20171016181942_add_tracking.rb deleted file mode 100644 index 3f6b612f..00000000 --- a/db/migrate/20171016181942_add_tracking.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddTracking < ActiveRecord::Migration[4.2] - def change - create_table :trackings do |t| - t.column :utm_campaign, :string, unique: true - t.column :utm_medium, :string, unique: true - t.column :utm_source, :string, unique: true - t.belongs_to :donation, index: true - t.timestamps - end - end -end diff --git a/db/migrate/20171024133806_add_queued_for_import_at_to_donation.rb b/db/migrate/20171024133806_add_queued_for_import_at_to_donation.rb deleted file mode 100644 index fbf374ae..00000000 --- a/db/migrate/20171024133806_add_queued_for_import_at_to_donation.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddQueuedForImportAtToDonation < ActiveRecord::Migration[4.2] - def change - add_column :donations, :queued_for_import_at, :datetime, default: nil - end -end diff --git a/db/migrate/20171026102139_add_direct_debit_detail.rb b/db/migrate/20171026102139_add_direct_debit_detail.rb deleted file mode 100644 index 5767fb9e..00000000 --- a/db/migrate/20171026102139_add_direct_debit_detail.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddDirectDebitDetail < ActiveRecord::Migration[4.2] - def change - create_table :direct_debit_details do |t| - t.string :iban - t.string :account_holder_name - t.string :bic - t.belongs_to :supporter, index: true - - t.timestamps - end - - add_column :donations, - :direct_debit_detail_id, - :integer, - index: true, - references: :direct_debit_details - end -end diff --git a/db/migrate/20171129215957_add_utm_content_to_trackings.rb b/db/migrate/20171129215957_add_utm_content_to_trackings.rb deleted file mode 100644 index 33d5961c..00000000 --- a/db/migrate/20171129215957_add_utm_content_to_trackings.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddUtmContentToTrackings < ActiveRecord::Migration[4.2] - def change - add_column :trackings, :utm_content, :string, unique: true - end -end diff --git a/db/migrate/20171130182254_add_locale_to_supporters.rb b/db/migrate/20171130182254_add_locale_to_supporters.rb deleted file mode 100644 index e4133378..00000000 --- a/db/migrate/20171130182254_add_locale_to_supporters.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddLocaleToSupporters < ActiveRecord::Migration[4.2] - def change - add_column :supporters, :locale, :string - end -end diff --git a/db/migrate/20171130193955_add_payment_provider_to_donations.rb b/db/migrate/20171130193955_add_payment_provider_to_donations.rb deleted file mode 100644 index a1a2f7b5..00000000 --- a/db/migrate/20171130193955_add_payment_provider_to_donations.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddPaymentProviderToDonations < ActiveRecord::Migration[4.2] - def change - add_column :donations, :payment_provider, :string - end -end diff --git a/db/migrate/20171206113317_add_direct_debit_detail_to_charges.rb b/db/migrate/20171206113317_add_direct_debit_detail_to_charges.rb deleted file mode 100644 index e68a2720..00000000 --- a/db/migrate/20171206113317_add_direct_debit_detail_to_charges.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddDirectDebitDetailToCharges < ActiveRecord::Migration[4.2] - def change - add_column :charges, :direct_debit_detail_id, :integer - end -end diff --git a/db/migrate/20171207114229_add_external_identifier_to_campaign.rb b/db/migrate/20171207114229_add_external_identifier_to_campaign.rb deleted file mode 100644 index 83237345..00000000 --- a/db/migrate/20171207114229_add_external_identifier_to_campaign.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddExternalIdentifierToCampaign < ActiveRecord::Migration[4.2] - def change - add_column :campaigns, :external_identifier, :string - end -end diff --git a/db/migrate/20171207191435_add_index_to_campaign_gifts.rb b/db/migrate/20171207191435_add_index_to_campaign_gifts.rb deleted file mode 100644 index c3ba0005..00000000 --- a/db/migrate/20171207191435_add_index_to_campaign_gifts.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexToCampaignGifts < ActiveRecord::Migration[4.2] - def change - add_index :campaign_gifts, :campaign_gift_option_id - end -end diff --git a/db/migrate/20171207191712_add_index_to_activities.rb b/db/migrate/20171207191712_add_index_to_activities.rb deleted file mode 100644 index 13b6e13f..00000000 --- a/db/migrate/20171207191712_add_index_to_activities.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexToActivities < ActiveRecord::Migration[4.2] - def change - add_index :activities, :supporter_id - add_index :activities, :nonprofit_id - end -end diff --git a/db/migrate/20171207200746_modify_supporters_name_index.rb b/db/migrate/20171207200746_modify_supporters_name_index.rb deleted file mode 100644 index c9c526b1..00000000 --- a/db/migrate/20171207200746_modify_supporters_name_index.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class ModifySupportersNameIndex < ActiveRecord::Migration[4.2] - def up - rename_index :supporters, :supporters_name, :supporters_lower_name - end - - def down - rename_index :supporters, :supporters_lower_name, :supporters_name - end -end diff --git a/db/migrate/20171207200950_add_supporters_name_index.rb b/db/migrate/20171207200950_add_supporters_name_index.rb deleted file mode 100644 index fbeeea63..00000000 --- a/db/migrate/20171207200950_add_supporters_name_index.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddSupportersNameIndex < ActiveRecord::Migration[4.2] - def change - add_index :supporters, :name - end -end diff --git a/db/migrate/20171207210431_add_charges_payment_id_index.rb b/db/migrate/20171207210431_add_charges_payment_id_index.rb deleted file mode 100644 index fafbc160..00000000 --- a/db/migrate/20171207210431_add_charges_payment_id_index.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddChargesPaymentIdIndex < ActiveRecord::Migration[4.2] - def change - add_index :charges, :payment_id - end -end diff --git a/db/migrate/20180106024119_add_indexes_for_supporter_deleted_and_import.rb b/db/migrate/20180106024119_add_indexes_for_supporter_deleted_and_import.rb deleted file mode 100644 index ee77f0a0..00000000 --- a/db/migrate/20180106024119_add_indexes_for_supporter_deleted_and_import.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddIndexesForSupporterDeletedAndImport < ActiveRecord::Migration[4.2] - def change - add_index :supporters, :deleted - add_index :supporters, :import_id - end -end diff --git a/db/migrate/20180119215653_create_payment_imports.rb b/db/migrate/20180119215653_create_payment_imports.rb deleted file mode 100644 index 5f28f392..00000000 --- a/db/migrate/20180119215653_create_payment_imports.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CreatePaymentImports < ActiveRecord::Migration[4.2] - def change - create_table :payment_imports do |t| - t.references :user - t.references :nonprofit - - t.timestamps - end - end -end diff --git a/db/migrate/20180119215913_create_donations_payment_imports_join_table.rb b/db/migrate/20180119215913_create_donations_payment_imports_join_table.rb deleted file mode 100644 index 383d5704..00000000 --- a/db/migrate/20180119215913_create_donations_payment_imports_join_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CreateDonationsPaymentImportsJoinTable < ActiveRecord::Migration[4.2] - def change - create_table :donations_payment_imports, id: false do |t| - t.references :donation - t.references :payment_import - end - end -end diff --git a/db/migrate/20180202181929_remove_unused_metadata.rb b/db/migrate/20180202181929_remove_unused_metadata.rb deleted file mode 100644 index 912ed772..00000000 --- a/db/migrate/20180202181929_remove_unused_metadata.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class RemoveUnusedMetadata < ActiveRecord::Migration[4.2] - TABLES = %i[ - campaign_gift_options - campaign_gifts - campaigns - cards - charges - custom_field_masters - custom_field_joins - disputes - donations - events - imports - nonprofits - offsite_payments - payments - payment_payouts - payouts - profiles - recurring_donations - refunds - roles - supporter_emails - supporter_notes - supporters - tag_joins - tag_masters - ticket_levels - tickets - users - ].freeze - FIELDS = %i[id metadata].freeze - - def up - TABLES.each do |table| - remove_column table, :metadata - end - end - - def down - TABLES.each do |table| - add_column table, :metadata, :text - end - end -end diff --git a/db/migrate/20180213191755_remove_recurring_donation_event_id.rb b/db/migrate/20180213191755_remove_recurring_donation_event_id.rb deleted file mode 100644 index 18ad187e..00000000 --- a/db/migrate/20180213191755_remove_recurring_donation_event_id.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class RemoveRecurringDonationEventId < ActiveRecord::Migration[4.2] - def change - change_table :recurring_donations do |t| - t.remove :event_id - end - end -end diff --git a/db/migrate/20180214124311_create_source_tokens.rb b/db/migrate/20180214124311_create_source_tokens.rb deleted file mode 100644 index 392265e6..00000000 --- a/db/migrate/20180214124311_create_source_tokens.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -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 - t.datetime :expiration - t.references :tokenizable, polymorphic: true - t.references :event - t.integer :max_uses, default: 1 - t.integer :total_uses, default: 0 - t.timestamps - end - - add_index :source_tokens, :token, unique: true - add_index :source_tokens, :expiration - add_index :source_tokens, %i[tokenizable_id tokenizable_type] - end -end diff --git a/db/migrate/20180215124311_add_card_token_to_ticket.rb b/db/migrate/20180215124311_add_card_token_to_ticket.rb deleted file mode 100644 index 9ebd12d3..00000000 --- a/db/migrate/20180215124311_add_card_token_to_ticket.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class AddCardTokenToTicket < ActiveRecord::Migration[4.2] - def up - add_column :tickets, :source_token_id, 'uuid' - end - - def down - remove_column :tickets, :source_token_id - end -end diff --git a/db/migrate/20180216064311_add_indexes_to_supporter_notes.rb b/db/migrate/20180216064311_add_indexes_to_supporter_notes.rb deleted file mode 100644 index 308707cb..00000000 --- a/db/migrate/20180216064311_add_indexes_to_supporter_notes.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesToSupporterNotes < ActiveRecord::Migration[4.2] - def change - add_index :supporter_notes, :supporter_id, order: { supporter_id: :asc } - end -end diff --git a/db/migrate/20180216124311_change_ddd_supporter_to_holder.rb b/db/migrate/20180216124311_change_ddd_supporter_to_holder.rb deleted file mode 100644 index 18a728d3..00000000 --- a/db/migrate/20180216124311_change_ddd_supporter_to_holder.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class ChangeDddSupporterToHolder < ActiveRecord::Migration[4.2] - def change - rename_column :direct_debit_details, :supporter_id, :holder_id - end -end diff --git a/db/migrate/20180217124311_remove_articles.rb b/db/migrate/20180217124311_remove_articles.rb deleted file mode 100644 index ac32250e..00000000 --- a/db/migrate/20180217124311_remove_articles.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class RemoveArticles < ActiveRecord::Migration[4.2] - def up - drop_table :articles - end - - def down; end -end diff --git a/db/migrate/20180608205049_add_index_to_supporter_id_on_tickets.rb b/db/migrate/20180608205049_add_index_to_supporter_id_on_tickets.rb deleted file mode 100644 index dee01b2e..00000000 --- a/db/migrate/20180608205049_add_index_to_supporter_id_on_tickets.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToSupporterIdOnTickets < ActiveRecord::Migration[4.2] - def change - add_index :tickets, :supporter_id - end -end diff --git a/db/migrate/20180608212658_add_index_to_event_id_on_donations_and_events.rb b/db/migrate/20180608212658_add_index_to_event_id_on_donations_and_events.rb deleted file mode 100644 index 3285aea3..00000000 --- a/db/migrate/20180608212658_add_index_to_event_id_on_donations_and_events.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToEventIdOnDonationsAndEvents < ActiveRecord::Migration[4.2] - def change - add_index :tickets, :event_id - add_index :donations, :event_id - end -end diff --git a/db/migrate/20180703165401_add_parent_campaign_id_to_campaigns.rb b/db/migrate/20180703165401_add_parent_campaign_id_to_campaigns.rb deleted file mode 100644 index befd6d80..00000000 --- a/db/migrate/20180703165401_add_parent_campaign_id_to_campaigns.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddParentCampaignIdToCampaigns < ActiveRecord::Migration[4.2] - def change - add_column :campaigns, :parent_campaign_id, :integer - end -end diff --git a/db/migrate/20180703165402_add_reason_for_supporting_to_campaigns.rb b/db/migrate/20180703165402_add_reason_for_supporting_to_campaigns.rb deleted file mode 100644 index 4de05ae9..00000000 --- a/db/migrate/20180703165402_add_reason_for_supporting_to_campaigns.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddReasonForSupportingToCampaigns < ActiveRecord::Migration[4.2] - def change - add_column :campaigns, :reason_for_supporting, :text - end -end diff --git a/db/migrate/20180703165404_add_default_reason_for_supporting_to_campaigns.rb b/db/migrate/20180703165404_add_default_reason_for_supporting_to_campaigns.rb deleted file mode 100644 index cf2257e5..00000000 --- a/db/migrate/20180703165404_add_default_reason_for_supporting_to_campaigns.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultReasonForSupportingToCampaigns < ActiveRecord::Migration[4.2] - def change - add_column :campaigns, :default_reason_for_supporting, :text - end -end diff --git a/db/migrate/20180703165405_add_banner_image_to_campaigns.rb b/db/migrate/20180703165405_add_banner_image_to_campaigns.rb deleted file mode 100644 index bb508f9a..00000000 --- a/db/migrate/20180703165405_add_banner_image_to_campaigns.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddBannerImageToCampaigns < ActiveRecord::Migration[4.2] - def change - add_column :campaigns, :banner_image, :string - end -end diff --git a/db/migrate/20180713213748_add_charge_id_indexes.rb b/db/migrate/20180713213748_add_charge_id_indexes.rb deleted file mode 100644 index 62e11f1c..00000000 --- a/db/migrate/20180713213748_add_charge_id_indexes.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddChargeIdIndexes < ActiveRecord::Migration[4.2] - def change - add_index :refunds, :charge_id - end -end diff --git a/db/migrate/20180713215825_add_payment_id_to_tickets.rb b/db/migrate/20180713215825_add_payment_id_to_tickets.rb deleted file mode 100644 index ffe5c3bf..00000000 --- a/db/migrate/20180713215825_add_payment_id_to_tickets.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddPaymentIdToTickets < ActiveRecord::Migration[4.2] - def change - add_index :tickets, :payment_id - end -end diff --git a/db/migrate/20180713220028_add_indexes_to_refunds.rb b/db/migrate/20180713220028_add_indexes_to_refunds.rb deleted file mode 100644 index a3afd31e..00000000 --- a/db/migrate/20180713220028_add_indexes_to_refunds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesToRefunds < ActiveRecord::Migration[4.2] - def change - add_index :refunds, :payment_id - end -end diff --git a/db/migrate/20181002160627_correct_dedications.rb b/db/migrate/20181002160627_correct_dedications.rb deleted file mode 100644 index e8f19b23..00000000 --- a/db/migrate/20181002160627_correct_dedications.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class CorrectDedications < ActiveRecord::Migration[4.2] - def up - execute <<~SQL - create or replace function is_valid_json(p_json text) - returns boolean - as - $$ - begin - return (p_json::json is not null); - exception - when others then - return false; - end; - $$ - language plpgsql - immutable; - SQL - - dedications = MaintainDedications.retrieve_non_json_dedications - - MaintainDedications.create_json_dedications_from_plain_text(dedications) - - dedications = MaintainDedications.retrieve_json_dedications - MaintainDedications.add_honor_to_any_json_dedications_without_type(dedications) - end - - def down; end -end diff --git a/db/migrate/20181003212559_correct_dedication_contacts.rb b/db/migrate/20181003212559_correct_dedication_contacts.rb deleted file mode 100644 index 0469e9d0..00000000 --- a/db/migrate/20181003212559_correct_dedication_contacts.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -class CorrectDedicationContacts < ActiveRecord::Migration[4.2] - def up - json_dedications = Qx.select('id', 'dedication').from(:donations) - .where("dedication IS NOT NULL AND dedication != ''") - .and_where('is_valid_json(dedication)').ex - parsed_dedications = json_dedications.map { |i| { id: i['id'], dedication: JSON.parse(i['dedication']) } } - with_contact_to_correct = parsed_dedications.select { |i| !i[:dedication]['contact'].blank? && i[:dedication]['contact'].is_a?(String) } - really_icky_dedications, easy_to_split_strings = with_contact_to_correct.partition { |i| i[:dedication]['contact'].split(' - ').count > 3 } - - easy_to_split_strings.map do |i| - split_contact = i[:dedication]['contact'].split(' - ') - i[:dedication]['contact'] = { - email: split_contact[0], - phone: split_contact[1], - address: split_contact[2] - } - puts i - i - end.each_with_index do |i, index| - unless i[:id] - raise Error("Item at index #{index} is invalid. Object:#{i}") - end - - Qx.update(:donations).where('id = $id', id: i[:id]).set(dedication: JSON.generate(i[:dedication])).ex - end - - puts "Corrected #{easy_to_split_strings.count} records." - - puts '' - puts '' - puts 'You must manually fix the following dedications: ' - really_icky_dedications.each do |i| - puts i - end - end - - def down - json_dedications = Qx.select('id', 'dedication').from(:donations) - .where("dedication IS NOT NULL AND dedication != ''") - .and_where('is_valid_json(dedication)').ex - - parsed_dedications = json_dedications.map { |i| { 'id' => i['id'], 'dedication' => JSON.parse(i['dedication']) } } - - with_contact_to_correct = parsed_dedications.select { |i| i['dedication']['contact'].is_a?(Hash) } - - puts "#{with_contact_to_correct.count} to revert" - with_contact_to_correct.each do |i| - contact_string = "#{i['dedication']['contact']['email']} - #{i['dedication']['contact']['phone']} - #{i['dedication']['contact']['address']}" - i['dedication']['contact'] = contact_string - Qx.update(:donations).where('id = $id', id: i['id']).set(dedication: JSON.generate(i['dedication'])).ex - end - end -end diff --git a/db/migrate/20181120182105_add_index_parent_campaign_id_to_campaign.rb b/db/migrate/20181120182105_add_index_parent_campaign_id_to_campaign.rb deleted file mode 100644 index 7ac47b68..00000000 --- a/db/migrate/20181120182105_add_index_parent_campaign_id_to_campaign.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexParentCampaignIdToCampaign < ActiveRecord::Migration[4.2] - def change - add_index :campaigns, :parent_campaign_id - end -end diff --git a/db/migrate/20181128221143_add_indexes_to_recurring_donations.rb b/db/migrate/20181128221143_add_indexes_to_recurring_donations.rb deleted file mode 100644 index 2bdda49c..00000000 --- a/db/migrate/20181128221143_add_indexes_to_recurring_donations.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexesToRecurringDonations < ActiveRecord::Migration[4.2] - def change - add_index :recurring_donations, :donation_id - end -end diff --git a/db/migrate/20181129205652_add_donation_id_index_to_campaign_gifts.rb b/db/migrate/20181129205652_add_donation_id_index_to_campaign_gifts.rb deleted file mode 100644 index 531ad348..00000000 --- a/db/migrate/20181129205652_add_donation_id_index_to_campaign_gifts.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddDonationIdIndexToCampaignGifts < ActiveRecord::Migration[4.2] - def change - add_index :campaign_gifts, :donation_id - end -end diff --git a/db/migrate/20181129224030_add_index_to_payments_created_at.rb b/db/migrate/20181129224030_add_index_to_payments_created_at.rb deleted file mode 100644 index c5057ef3..00000000 --- a/db/migrate/20181129224030_add_index_to_payments_created_at.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToPaymentsCreatedAt < ActiveRecord::Migration[4.2] - def change - add_index :payments, :created_at - end -end