diff --git a/db/migrate/20160622154200_create_users.rb b/db/migrate/20160622154200_create_users.rb deleted file mode 100644 index a8d1c705ec..0000000000 --- a/db/migrate/20160622154200_create_users.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateUsers < ActiveRecord::Migration[5.1] - def change - create_table :users do |t| - t.string :name - t.string :email - t.string :uid - t.string :organisation_slug - t.string :organisation_content_id - t.string :app_name - t.text :permissions - t.boolean :remotely_signed_out, default: false - t.boolean :disabled, default: false - t.timestamps - end - end -end diff --git a/db/migrate/20180716161306_create_documents.rb b/db/migrate/20180716161306_create_documents.rb deleted file mode 100644 index 566d390354..0000000000 --- a/db/migrate/20180716161306_create_documents.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateDocuments < ActiveRecord::Migration[5.2] - def change - create_table :documents do |t| - t.string :content_id, null: false - t.string :locale, null: false - t.index %i[content_id locale], unique: true - - t.string :document_type - t.string :title - - t.timestamps - end - end -end diff --git a/db/migrate/20180723183132_add_contents_to_documents.rb b/db/migrate/20180723183132_add_contents_to_documents.rb deleted file mode 100644 index 1a2a2ddd71..0000000000 --- a/db/migrate/20180723183132_add_contents_to_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddContentsToDocuments < ActiveRecord::Migration[5.2] - def change - add_column :documents, :contents, :json, default: "{}" - end -end diff --git a/db/migrate/20180725084729_fix_document_contents_default.rb b/db/migrate/20180725084729_fix_document_contents_default.rb deleted file mode 100644 index f27b20d886..0000000000 --- a/db/migrate/20180725084729_fix_document_contents_default.rb +++ /dev/null @@ -1,9 +0,0 @@ -class FixDocumentContentsDefault < ActiveRecord::Migration[5.2] - def up - change_column_default :documents, :contents, {} - end - - def down - change_column_default :documents, :contents, "{}" - end -end diff --git a/db/migrate/20180725091148_add_summary_to_documents.rb b/db/migrate/20180725091148_add_summary_to_documents.rb deleted file mode 100644 index 102eac40f2..0000000000 --- a/db/migrate/20180725091148_add_summary_to_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSummaryToDocuments < ActiveRecord::Migration[5.2] - def change - add_column :documents, :summary, :text - end -end diff --git a/db/migrate/20180725095923_add_base_path_to_documents.rb b/db/migrate/20180725095923_add_base_path_to_documents.rb deleted file mode 100644 index 9894b62c87..0000000000 --- a/db/migrate/20180725095923_add_base_path_to_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBasePathToDocuments < ActiveRecord::Migration[5.2] - def change - add_column :documents, :base_path, :string - end -end diff --git a/db/migrate/20180731145851_add_associations_to_document.rb b/db/migrate/20180731145851_add_associations_to_document.rb deleted file mode 100644 index 3098d8d2c7..0000000000 --- a/db/migrate/20180731145851_add_associations_to_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAssociationsToDocument < ActiveRecord::Migration[5.2] - def change - add_column :documents, :associations, :json, default: {} - end -end diff --git a/db/migrate/20180803101418_add_unique_index_to_base_path.rb b/db/migrate/20180803101418_add_unique_index_to_base_path.rb deleted file mode 100644 index 493f629166..0000000000 --- a/db/migrate/20180803101418_add_unique_index_to_base_path.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUniqueIndexToBasePath < ActiveRecord::Migration[5.2] - def change - add_index :documents, :base_path, unique: true - end -end diff --git a/db/migrate/20180814134709_add_publication_state_to_documents.rb b/db/migrate/20180814134709_add_publication_state_to_documents.rb deleted file mode 100644 index c6fdd5b240..0000000000 --- a/db/migrate/20180814134709_add_publication_state_to_documents.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddPublicationStateToDocuments < ActiveRecord::Migration[5.2] - def up - execute "TRUNCATE documents" - add_column :documents, :publication_state, :string, null: false # rubocop:disable Rails/NotNullColumn - end - - def down; end -end diff --git a/db/migrate/20180820155844_create_active_storage_tables.active_storage.rb b/db/migrate/20180820155844_create_active_storage_tables.active_storage.rb deleted file mode 100644 index b7e171c81a..0000000000 --- a/db/migrate/20180820155844_create_active_storage_tables.active_storage.rb +++ /dev/null @@ -1,26 +0,0 @@ -# This migration comes from active_storage (originally 20170806125915) -class CreateActiveStorageTables < ActiveRecord::Migration[5.2] - def change - create_table :active_storage_blobs do |t| - t.string :key, null: false - t.string :filename, null: false - t.string :content_type - t.text :metadata - t.bigint :byte_size, null: false - t.string :checksum, null: false - t.datetime :created_at, null: false - - t.index %i[key], unique: true - end - - create_table :active_storage_attachments do |t| - t.string :name, null: false - t.references :record, null: false, polymorphic: true, index: false - t.references :blob, null: false - - t.datetime :created_at, null: false - - t.index %i[record_type record_id name blob_id], name: "index_active_storage_attachments_uniqueness", unique: true - end - end -end diff --git a/db/migrate/20180823143905_create_images.rb b/db/migrate/20180823143905_create_images.rb deleted file mode 100644 index 3a0ed61169..0000000000 --- a/db/migrate/20180823143905_create_images.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateImages < ActiveRecord::Migration[5.2] - def change - create_table :images do |t| - t.references :document, - foreign_key: { on_delete: :cascade }, - index: true, - null: false - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, on_delete: :cascade }, - index: true, - null: false - t.string :filename, null: false - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.timestamps - end - end -end diff --git a/db/migrate/20180831100426_add_creator_to_documents.rb b/db/migrate/20180831100426_add_creator_to_documents.rb deleted file mode 100644 index 54351ac5dd..0000000000 --- a/db/migrate/20180831100426_add_creator_to_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCreatorToDocuments < ActiveRecord::Migration[5.2] - def change - add_reference :documents, :creator, foreign_key: { to_table: :users } - end -end diff --git a/db/migrate/20180904124348_add_review_state_to_documents.rb b/db/migrate/20180904124348_add_review_state_to_documents.rb deleted file mode 100644 index 07082ec7ed..0000000000 --- a/db/migrate/20180904124348_add_review_state_to_documents.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddReviewStateToDocuments < ActiveRecord::Migration[5.2] - def up - execute "TRUNCATE documents CASCADE" - add_column :documents, :review_state, :string, null: false # rubocop:disable Rails/NotNullColumn - end - - def down - remove_column :documents, :review_state - end -end diff --git a/db/migrate/20180905134625_rename_associations_to_tags.rb b/db/migrate/20180905134625_rename_associations_to_tags.rb deleted file mode 100644 index 4e30a46258..0000000000 --- a/db/migrate/20180905134625_rename_associations_to_tags.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameAssociationsToTags < ActiveRecord::Migration[5.2] - def change - rename_column :documents, :associations, :tags - end -end diff --git a/db/migrate/20180905142136_add_lead_image_to_document.rb b/db/migrate/20180905142136_add_lead_image_to_document.rb deleted file mode 100644 index 2efb67c0de..0000000000 --- a/db/migrate/20180905142136_add_lead_image_to_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLeadImageToDocument < ActiveRecord::Migration[5.2] - def change - add_reference :documents, :lead_image, foreign_key: { to_table: :images } - end -end diff --git a/db/migrate/20180905150545_add_image_metadata_fields.rb b/db/migrate/20180905150545_add_image_metadata_fields.rb deleted file mode 100644 index 4a6162b70f..0000000000 --- a/db/migrate/20180905150545_add_image_metadata_fields.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddImageMetadataFields < ActiveRecord::Migration[5.2] - def change - change_table :images, bulk: true do |t| - t.string :caption - t.string :alt_text - t.string :credit - end - end -end diff --git a/db/migrate/20180906154457_add_has_live_version_on_govuk_to_documents.rb b/db/migrate/20180906154457_add_has_live_version_on_govuk_to_documents.rb deleted file mode 100644 index 85ab4e8356..0000000000 --- a/db/migrate/20180906154457_add_has_live_version_on_govuk_to_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddHasLiveVersionOnGovukToDocuments < ActiveRecord::Migration[5.2] - def change - add_column :documents, :has_live_version_on_govuk, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20180906155513_add_change_notes_to_documents.rb b/db/migrate/20180906155513_add_change_notes_to_documents.rb deleted file mode 100644 index bd779ec986..0000000000 --- a/db/migrate/20180906155513_add_change_notes_to_documents.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddChangeNotesToDocuments < ActiveRecord::Migration[5.2] - def change - change_table :documents, bulk: true do |t| - t.column :change_note, :text - t.column :update_type, :string - end - end -end diff --git a/db/migrate/20180907121447_create_timeline_entries.rb b/db/migrate/20180907121447_create_timeline_entries.rb deleted file mode 100644 index f471789b78..0000000000 --- a/db/migrate/20180907121447_create_timeline_entries.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateTimelineEntries < ActiveRecord::Migration[5.2] - def change - create_table :timeline_entries do |t| - t.string :entry_type, null: false - - # Delete all timeline_entries if a document is deleted - t.references :document, foreign_key: { on_delete: :cascade }, null: false - - # Don't allow users to be deleted if they're related to a timeline entry - t.references :user, foreign_key: { on_delete: :restrict } - - t.timestamps - end - end -end diff --git a/db/migrate/20180913105125_add_asset_manager_file_url_to_image.rb b/db/migrate/20180913105125_add_asset_manager_file_url_to_image.rb deleted file mode 100644 index 133bbb9da9..0000000000 --- a/db/migrate/20180913105125_add_asset_manager_file_url_to_image.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAssetManagerFileUrlToImage < ActiveRecord::Migration[5.2] - def change - add_column :images, :asset_manager_file_url, :string - end -end diff --git a/db/migrate/20180917162353_nullify_lead_image_foreign_key.rb b/db/migrate/20180917162353_nullify_lead_image_foreign_key.rb deleted file mode 100644 index bdb9fc8d29..0000000000 --- a/db/migrate/20180917162353_nullify_lead_image_foreign_key.rb +++ /dev/null @@ -1,6 +0,0 @@ -class NullifyLeadImageForeignKey < ActiveRecord::Migration[5.2] - def change - remove_foreign_key "documents", "images" - add_foreign_key "documents", "images", column: :lead_image_id, on_delete: :nullify - end -end diff --git a/db/migrate/20180919140521_create_versions.rb b/db/migrate/20180919140521_create_versions.rb deleted file mode 100644 index b22fd2d68d..0000000000 --- a/db/migrate/20180919140521_create_versions.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateVersions < ActiveRecord::Migration[5.2] - def change - create_table :versions do |t| - t.string :item_type, null: false - t.integer :item_id, null: false - t.string :event, null: false - t.string :whodunnit - t.text :object - t.text :object_changes - t.datetime :created_at - end - - add_index :versions, %i(item_type item_id) - end -end diff --git a/db/migrate/20180919150956_current_edition_number_to_documents.rb b/db/migrate/20180919150956_current_edition_number_to_documents.rb deleted file mode 100644 index a4e9b335b7..0000000000 --- a/db/migrate/20180919150956_current_edition_number_to_documents.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CurrentEditionNumberToDocuments < ActiveRecord::Migration[5.2] - def up - execute "TRUNCATE documents CASCADE" - add_column :documents, :current_edition_number, :integer, null: false # rubocop:disable Rails/NotNullColumn - add_column :timeline_entries, :edition_number, :integer, null: false # rubocop:disable Rails/NotNullColumn - end - - def down - remove_column :documents, :current_edition_number - remove_column :timeline_entries, :edition_number - end -end diff --git a/db/migrate/20180925082624_add_last_editor_to_document.rb b/db/migrate/20180925082624_add_last_editor_to_document.rb deleted file mode 100644 index 342f336654..0000000000 --- a/db/migrate/20180925082624_add_last_editor_to_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLastEditorToDocument < ActiveRecord::Migration[5.2] - def change - add_reference :documents, :last_editor, foreign_key: { to_table: :users } - end -end diff --git a/db/migrate/20181128112113_add_live_state_to_document.rb b/db/migrate/20181128112113_add_live_state_to_document.rb deleted file mode 100644 index c87673eb2d..0000000000 --- a/db/migrate/20181128112113_add_live_state_to_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLiveStateToDocument < ActiveRecord::Migration[5.2] - def change - add_column :documents, :live_state, :string - end -end diff --git a/db/migrate/20181203123128_create_retirements.rb b/db/migrate/20181203123128_create_retirements.rb deleted file mode 100644 index 51fea8cbc0..0000000000 --- a/db/migrate/20181203123128_create_retirements.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateRetirements < ActiveRecord::Migration[5.2] - def change - create_table :retirements do |t| - t.string :explanatory_note - - # Delete all retirement entires if a timeline entry is deleted - t.references :timeline_entries, foreign_key: { on_delete: :cascade }, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20181203134354_create_removals.rb b/db/migrate/20181203134354_create_removals.rb deleted file mode 100644 index 5161f3b979..0000000000 --- a/db/migrate/20181203134354_create_removals.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateRemovals < ActiveRecord::Migration[5.2] - def change - create_table :removals do |t| - t.string :explanatory_note - t.string :alternative_path - t.boolean :redirect, default: false - - # Delete all removal entires if a timeline entry is deleted - t.references :timeline_entries, foreign_key: { on_delete: :cascade }, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20181206102803_rename_document_type_id.rb b/db/migrate/20181206102803_rename_document_type_id.rb deleted file mode 100644 index 76ba9442f1..0000000000 --- a/db/migrate/20181206102803_rename_document_type_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameDocumentTypeId < ActiveRecord::Migration[5.2] - def change - rename_column :documents, :document_type, :document_type_id - end -end diff --git a/db/migrate/20181207101337_ensure_docs_have_doc_type.rb b/db/migrate/20181207101337_ensure_docs_have_doc_type.rb deleted file mode 100644 index cefa724181..0000000000 --- a/db/migrate/20181207101337_ensure_docs_have_doc_type.rb +++ /dev/null @@ -1,5 +0,0 @@ -class EnsureDocsHaveDocType < ActiveRecord::Migration[5.2] - def change - change_column :documents, :document_type_id, :string, null: false - end -end diff --git a/db/migrate/20181210133134_add_publication_state_to_images.rb b/db/migrate/20181210133134_add_publication_state_to_images.rb deleted file mode 100644 index f6e74676eb..0000000000 --- a/db/migrate/20181210133134_add_publication_state_to_images.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPublicationStateToImages < ActiveRecord::Migration[5.2] - def change - add_column :images, :publication_state, :string, null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181210200345_create_versioned_documents.rb b/db/migrate/20181210200345_create_versioned_documents.rb deleted file mode 100644 index 88b6bf4c67..0000000000 --- a/db/migrate/20181210200345_create_versioned_documents.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateVersionedDocuments < ActiveRecord::Migration[5.2] - def change - create_table :versioned_documents do |t| - t.uuid :content_id, null: false - t.string :locale, null: false - t.string :document_type_id, null: false - t.datetime :last_edited_at - t.timestamps - - t.references :created_by, - foreign_key: { to_table: :users, on_delete: :restrict }, - index: true - t.index %i[content_id locale], unique: true - end - end -end diff --git a/db/migrate/20181210205100_create_versioned_editions.rb b/db/migrate/20181210205100_create_versioned_editions.rb deleted file mode 100644 index a47a3db4c3..0000000000 --- a/db/migrate/20181210205100_create_versioned_editions.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateVersionedEditions < ActiveRecord::Migration[5.2] - def change - create_table :versioned_editions do |t| - t.integer :number, null: false - t.datetime :last_edited_at - t.timestamps - - t.references :document, - foreign_key: { to_table: :versioned_documents, on_delete: :restrict }, - index: true, - null: false - - t.references :created_by, - foreign_key: { to_table: :users, on_delete: :restrict }, - index: true - end - end -end diff --git a/db/migrate/20181210214512_add_current_and_live_flags_to_versioned_editions.rb b/db/migrate/20181210214512_add_current_and_live_flags_to_versioned_editions.rb deleted file mode 100644 index 4181f3c671..0000000000 --- a/db/migrate/20181210214512_add_current_and_live_flags_to_versioned_editions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddCurrentAndLiveFlagsToVersionedEditions < ActiveRecord::Migration[5.2] - def change - change_table :versioned_editions, bulk: true do |t| - t.column :current, :boolean, null: false, default: false - t.column :live, :boolean, null: false, default: false - t.index %i[document_id current], unique: true, where: "current = true" - t.index %i[document_id live], unique: true, where: "live = true" - end - end -end diff --git a/db/migrate/20181210223006_unique_index_of_versioned_editions_number.rb b/db/migrate/20181210223006_unique_index_of_versioned_editions_number.rb deleted file mode 100644 index 4ac2756190..0000000000 --- a/db/migrate/20181210223006_unique_index_of_versioned_editions_number.rb +++ /dev/null @@ -1,5 +0,0 @@ -class UniqueIndexOfVersionedEditionsNumber < ActiveRecord::Migration[5.2] - def change - add_index :versioned_editions, %i[document_id number], unique: true - end -end diff --git a/db/migrate/20181210223527_create_versioned_revisions.rb b/db/migrate/20181210223527_create_versioned_revisions.rb deleted file mode 100644 index f122e6d53f..0000000000 --- a/db/migrate/20181210223527_create_versioned_revisions.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateVersionedRevisions < ActiveRecord::Migration[5.2] - def change - create_table :versioned_revisions do |t| - t.string :title - t.string :base_path - t.text :summary - t.json :contents, default: {}, null: false - t.json :tags, default: {}, null: false - t.text :change_note - t.string :update_type - - t.references :created_by, - foreign_key: { to_table: :users, on_delete: :restrict }, - index: true - - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20181210230332_add_current_revision_to_editions.rb b/db/migrate/20181210230332_add_current_revision_to_editions.rb deleted file mode 100644 index 4912b3ba0a..0000000000 --- a/db/migrate/20181210230332_add_current_revision_to_editions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddCurrentRevisionToEditions < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_editions, - :current_revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181211000828_create_versioned_edition_revisions.rb b/db/migrate/20181211000828_create_versioned_edition_revisions.rb deleted file mode 100644 index 2f7b7a92a1..0000000000 --- a/db/migrate/20181211000828_create_versioned_edition_revisions.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateVersionedEditionRevisions < ActiveRecord::Migration[5.2] - def change - create_table :versioned_edition_revisions do |t| - t.references :edition, - foreign_key: { to_table: :versioned_editions, on_delete: :restrict }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20181211215252_create_versioned_images.rb b/db/migrate/20181211215252_create_versioned_images.rb deleted file mode 100644 index 63341f9c2f..0000000000 --- a/db/migrate/20181211215252_create_versioned_images.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CreateVersionedImages < ActiveRecord::Migration[5.2] - def change - create_table :versioned_images do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, on_delete: :restrict }, - index: true, - null: false - t.string :filename, null: false - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.string "caption" - t.string "alt_text" - t.string "credit" - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20181211221709_create_versioned_revision_images.rb b/db/migrate/20181211221709_create_versioned_revision_images.rb deleted file mode 100644 index f44d9c7cd8..0000000000 --- a/db/migrate/20181211221709_create_versioned_revision_images.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateVersionedRevisionImages < ActiveRecord::Migration[5.2] - def change - create_table :versioned_revision_images do |t| - t.references :image, - foreign_key: { to_table: :versioned_images, on_delete: :restrict }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20181211223329_add_lead_image_to_versioned_revisions.rb b/db/migrate/20181211223329_add_lead_image_to_versioned_revisions.rb deleted file mode 100644 index db60869487..0000000000 --- a/db/migrate/20181211223329_add_lead_image_to_versioned_revisions.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddLeadImageToVersionedRevisions < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_revisions, - :lead_image, - foreign_key: { to_table: :versioned_images, on_delete: :restrict }, - index: true - end -end diff --git a/db/migrate/20181212165840_create_internal_notes.rb b/db/migrate/20181212165840_create_internal_notes.rb deleted file mode 100644 index 309aafad21..0000000000 --- a/db/migrate/20181212165840_create_internal_notes.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateInternalNotes < ActiveRecord::Migration[5.2] - def change - create_table :internal_notes do |t| - t.text :body, null: false - t.references :document, foreign_key: { on_delete: :cascade }, null: false - t.references :user, foreign_key: { on_delete: :nullify } - t.references :timeline_entries, foreign_key: true, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20181212201517_dont_restrict_user_deletion.rb b/db/migrate/20181212201517_dont_restrict_user_deletion.rb deleted file mode 100644 index c47585b629..0000000000 --- a/db/migrate/20181212201517_dont_restrict_user_deletion.rb +++ /dev/null @@ -1,19 +0,0 @@ -class DontRestrictUserDeletion < ActiveRecord::Migration[5.2] - def up - remove_foreign_key :versioned_documents, column: :created_by_id - add_foreign_key :versioned_documents, :users, column: :created_by_id, on_delete: :nullify - remove_foreign_key :versioned_editions, column: :created_by_id - add_foreign_key :versioned_editions, :users, column: :created_by_id, on_delete: :nullify - remove_foreign_key :versioned_revisions, column: :created_by_id - add_foreign_key :versioned_revisions, :users, column: :created_by_id, on_delete: :nullify - end - - def down - remove_foreign_key :versioned_documents, column: :created_by_id - add_foreign_key :versioned_documents, :users, column: :created_by_id, on_delete: :restrict - remove_foreign_key :versioned_editions, column: :created_by_id - add_foreign_key :versioned_editions, :users, column: :created_by_id, on_delete: :restrict - remove_foreign_key :versioned_revisions, column: :created_by_id - add_foreign_key :versioned_revisions, :users, column: :created_by_id, on_delete: :restrict - end -end diff --git a/db/migrate/20181214112140_nullify_user_for_timeline_entry.rb b/db/migrate/20181214112140_nullify_user_for_timeline_entry.rb deleted file mode 100644 index f5b162b17e..0000000000 --- a/db/migrate/20181214112140_nullify_user_for_timeline_entry.rb +++ /dev/null @@ -1,11 +0,0 @@ -class NullifyUserForTimelineEntry < ActiveRecord::Migration[5.2] - def up - remove_foreign_key "timeline_entries", "users" - add_foreign_key "timeline_entries", "users", on_delete: :nullify - end - - def down - remove_foreign_key "timeline_entries", "users" - add_foreign_key "timeline_entries", "users", on_delete: :restrict - end -end diff --git a/db/migrate/20181220200419_reference_document_from_revision.rb b/db/migrate/20181220200419_reference_document_from_revision.rb deleted file mode 100644 index 28be7db286..0000000000 --- a/db/migrate/20181220200419_reference_document_from_revision.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ReferenceDocumentFromRevision < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_revisions, - :document, - foreign_key: { to_table: :versioned_documents, - on_delete: :restrict }, - index: true, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181221221453_unique_edition_revisions.rb b/db/migrate/20181221221453_unique_edition_revisions.rb deleted file mode 100644 index 39f9bdccd2..0000000000 --- a/db/migrate/20181221221453_unique_edition_revisions.rb +++ /dev/null @@ -1,7 +0,0 @@ -class UniqueEditionRevisions < ActiveRecord::Migration[5.2] - def change - add_index :versioned_edition_revisions, - %i[edition_id revision_id], - unique: true - end -end diff --git a/db/migrate/20181221223928_add_last_edited_by_to_document.rb b/db/migrate/20181221223928_add_last_edited_by_to_document.rb deleted file mode 100644 index 6a7cf017e2..0000000000 --- a/db/migrate/20181221223928_add_last_edited_by_to_document.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddLastEditedByToDocument < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_documents, - :last_edited_by, - foreign_key: { to_table: :users, on_delete: :nullify }, - index: true - end -end diff --git a/db/migrate/20181221223935_add_last_edited_by_to_edition.rb b/db/migrate/20181221223935_add_last_edited_by_to_edition.rb deleted file mode 100644 index d71572fbee..0000000000 --- a/db/migrate/20181221223935_add_last_edited_by_to_edition.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddLastEditedByToEdition < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_editions, - :last_edited_by, - foreign_key: { to_table: :users, on_delete: :nullify }, - index: true - end -end diff --git a/db/migrate/20181221225919_last_edited_at_not_null.rb b/db/migrate/20181221225919_last_edited_at_not_null.rb deleted file mode 100644 index e9e93a973a..0000000000 --- a/db/migrate/20181221225919_last_edited_at_not_null.rb +++ /dev/null @@ -1,6 +0,0 @@ -class LastEditedAtNotNull < ActiveRecord::Migration[5.2] - def change - change_column_null :versioned_documents, :last_edited_at, false - change_column_null :versioned_editions, :last_edited_at, false - end -end diff --git a/db/migrate/20181221235316_unique_index_on_revision_images.rb b/db/migrate/20181221235316_unique_index_on_revision_images.rb deleted file mode 100644 index 2d78a7e306..0000000000 --- a/db/migrate/20181221235316_unique_index_on_revision_images.rb +++ /dev/null @@ -1,7 +0,0 @@ -class UniqueIndexOnRevisionImages < ActiveRecord::Migration[5.2] - def change - add_index :versioned_revision_images, - %i[revision_id image_id], - unique: true - end -end diff --git a/db/migrate/20181228102002_create_versioned_edition_statuses.rb b/db/migrate/20181228102002_create_versioned_edition_statuses.rb deleted file mode 100644 index 395462861c..0000000000 --- a/db/migrate/20181228102002_create_versioned_edition_statuses.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateVersionedEditionStatuses < ActiveRecord::Migration[5.2] - def change - create_table :versioned_edition_statuses do |t| - t.string :user_facing_state, null: false - t.string :publishing_api_sync, null: false - t.references :revision_at_creation, - foreign_key: { to_table: :versioned_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :edition, - foreign_key: { to_table: :versioned_editions, - on_delete: :restrict }, - index: true - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: true - - t.timestamps - - t.index :user_facing_state - end - end -end diff --git a/db/migrate/20181228105905_reference_status_on_edition.rb b/db/migrate/20181228105905_reference_status_on_edition.rb deleted file mode 100644 index 4743c4bd9a..0000000000 --- a/db/migrate/20181228105905_reference_status_on_edition.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ReferenceStatusOnEdition < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_editions, - :status, - foreign_key: { to_table: :versioned_edition_statuses, - on_delete: :restrict }, - index: true, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181228124658_change_current_revision_to_revision.rb b/db/migrate/20181228124658_change_current_revision_to_revision.rb deleted file mode 100644 index 99ce9f1687..0000000000 --- a/db/migrate/20181228124658_change_current_revision_to_revision.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ChangeCurrentRevisionToRevision < ActiveRecord::Migration[5.2] - def change - remove_reference :versioned_editions, - :current_revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false - add_reference :versioned_editions, - :revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181228160727_add_current_and_live_indexes_to_documents.rb b/db/migrate/20181228160727_add_current_and_live_indexes_to_documents.rb deleted file mode 100644 index fa68cca8d8..0000000000 --- a/db/migrate/20181228160727_add_current_and_live_indexes_to_documents.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddCurrentAndLiveIndexesToDocuments < ActiveRecord::Migration[5.2] - def change - add_index :versioned_editions, :current - add_index :versioned_editions, :live - end -end diff --git a/db/migrate/20181231123820_update_type_not_null.rb b/db/migrate/20181231123820_update_type_not_null.rb deleted file mode 100644 index b5237770b8..0000000000 --- a/db/migrate/20181231123820_update_type_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class UpdateTypeNotNull < ActiveRecord::Migration[5.2] - def change - change_column_null :versioned_revisions, :update_type, false - end -end diff --git a/db/migrate/20181231145623_add_draft_to_edition.rb b/db/migrate/20181231145623_add_draft_to_edition.rb deleted file mode 100644 index 0a948baa3f..0000000000 --- a/db/migrate/20181231145623_add_draft_to_edition.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddDraftToEdition < ActiveRecord::Migration[5.2] - def change - add_column :versioned_editions, - :draft, - :string, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20181231150103_remove_publishing_api_sync.rb b/db/migrate/20181231150103_remove_publishing_api_sync.rb deleted file mode 100644 index 9eafd98d6c..0000000000 --- a/db/migrate/20181231150103_remove_publishing_api_sync.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RemovePublishingApiSync < ActiveRecord::Migration[5.2] - def change - remove_column :versioned_edition_statuses, - :publishing_api_sync, - :string, - null: false - end -end diff --git a/db/migrate/20190102104920_drop_versioned_images.rb b/db/migrate/20190102104920_drop_versioned_images.rb deleted file mode 100644 index e06392d476..0000000000 --- a/db/migrate/20190102104920_drop_versioned_images.rb +++ /dev/null @@ -1,44 +0,0 @@ -class DropVersionedImages < ActiveRecord::Migration[5.2] - def up - remove_reference :versioned_revisions, :lead_image - drop_table :versioned_revision_images - drop_table :versioned_images - end - - def down - create_table :versioned_images do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, on_delete: :restrict }, - index: true, - null: false - t.string :filename, null: false - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.string "caption" - t.string "alt_text" - t.string "credit" - t.datetime :created_at, null: false - end - - create_table :versioned_revision_images do |t| - t.references :image, - foreign_key: { to_table: :versioned_images, on_delete: :restrict }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, on_delete: :restrict }, - index: true, - null: false - t.datetime :created_at, null: false - end - - add_reference :versioned_revisions, - :lead_image, - foreign_key: { to_table: :versioned_images, on_delete: :restrict }, - index: true - end -end diff --git a/db/migrate/20190102110013_create_versioned_image_tables.rb b/db/migrate/20190102110013_create_versioned_image_tables.rb deleted file mode 100644 index b0edc088fc..0000000000 --- a/db/migrate/20190102110013_create_versioned_image_tables.rb +++ /dev/null @@ -1,57 +0,0 @@ -class CreateVersionedImageTables < ActiveRecord::Migration[5.2] - def change - create_table :versioned_images do |t| - t.references :created_by, - foreign_key: { to_table: :users, on_delete: :nullify }, - index: false - t.datetime :created_at, null: false - end - - create_table :versioned_image_revisions do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, - on_delete: :restrict }, - index: true, - null: false - t.references :image, - foreign_key: { to_table: :versioned_images, - on_delete: :restrict }, - index: true, - null: false - t.references :created_by, - foreign_key: { to_table: :users, on_delete: :nullify }, - index: false - t.string :filename, null: false - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.string :caption - t.string :alt_text - t.string :credit - t.datetime :created_at, null: false - end - - create_table :versioned_revision_image_revisions do |t| - t.references :image_revision, - foreign_key: { to_table: :versioned_image_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, - on_delete: :restrict }, - index: true, - null: false - t.datetime :created_at, null: false - end - - add_reference :versioned_revisions, - :lead_image_revision, - foreign_key: { to_table: :versioned_image_revisions, - on_delete: :restrict }, - index: true - end -end diff --git a/db/migrate/20190102181318_create_versioned_asset_manager_file.rb b/db/migrate/20190102181318_create_versioned_asset_manager_file.rb deleted file mode 100644 index b1d170b4dd..0000000000 --- a/db/migrate/20190102181318_create_versioned_asset_manager_file.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateVersionedAssetManagerFile < ActiveRecord::Migration[5.2] - def change - create_table :versioned_asset_manager_files do |t| - t.string :file_url - t.string :state, null: false, default: "absent" - t.timestamps - - t.index :file_url, unique: true - end - end -end diff --git a/db/migrate/20190102182816_create_versioned_asset_manager_image_variants.rb b/db/migrate/20190102182816_create_versioned_asset_manager_image_variants.rb deleted file mode 100644 index 3b2cfbeb86..0000000000 --- a/db/migrate/20190102182816_create_versioned_asset_manager_image_variants.rb +++ /dev/null @@ -1,29 +0,0 @@ -class CreateVersionedAssetManagerImageVariants < ActiveRecord::Migration[5.2] - def change - create_table :versioned_asset_manager_image_variants do |t| - t.references :image_revision, - foreign_key: { to_table: :versioned_image_revisions, - on_delete: :cascade }, - index: false, - null: false - - t.references :asset_manager_file, - foreign_key: { to_table: :versioned_asset_manager_files, - on_delete: :restrict }, - index: false, - null: false - - t.string :variant, null: false - - t.datetime :created_at, null: false - - t.index %i[image_revision_id asset_manager_file_id], - unique: true, - name: "index_image_revision_asset_manager_variant_ids" - - t.index %i[image_revision_id variant], - unique: true, - name: "index_image_revision_asset_manager_variant_unique_variant" - end - end -end diff --git a/db/migrate/20190107171132_add_superseded_by_to_versioned_asset_manager_files.rb b/db/migrate/20190107171132_add_superseded_by_to_versioned_asset_manager_files.rb deleted file mode 100644 index 6ab9adb280..0000000000 --- a/db/migrate/20190107171132_add_superseded_by_to_versioned_asset_manager_files.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddSupersededByToVersionedAssetManagerFiles < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_asset_manager_files, - :superseded_by, - foreign_key: { to_table: :versioned_asset_manager_files, - on_delete: :nullify }, - index: false, - null: true - end -end diff --git a/db/migrate/20190108111128_create_versioned_timeline_entry.rb b/db/migrate/20190108111128_create_versioned_timeline_entry.rb deleted file mode 100644 index 77e5a47669..0000000000 --- a/db/migrate/20190108111128_create_versioned_timeline_entry.rb +++ /dev/null @@ -1,41 +0,0 @@ -class CreateVersionedTimelineEntry < ActiveRecord::Migration[5.2] - def change - create_table :versioned_timeline_entries do |t| - t.references :document, - foreign_key: { to_table: :versioned_documents, - on_delete: :cascade }, - index: true, - null: false - - t.references :edition, - foreign_key: { to_table: :versioned_editions, - on_delete: :cascade }, - index: true, - null: true - - t.references :revision, - foreign_key: { to_table: :versioned_revisions, - on_delete: :nullify }, - index: false, - null: true - - t.references :edition_status, - foreign_key: { to_table: :versioned_edition_statuses, - on_delete: :nullify }, - index: false, - null: true - - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: true, - null: true - - t.references :details, polymorphic: true - - t.datetime :created_at, null: false - - t.string :entry_type, null: false - end - end -end diff --git a/db/migrate/20190109203505_create_versioned_content_revision.rb b/db/migrate/20190109203505_create_versioned_content_revision.rb deleted file mode 100644 index f169667ff2..0000000000 --- a/db/migrate/20190109203505_create_versioned_content_revision.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateVersionedContentRevision < ActiveRecord::Migration[5.2] - def change - create_table :versioned_content_revisions do |t| - t.string :title - t.string :base_path - t.text :summary - t.json :contents, default: {}, null: false - t.datetime :created_at - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: false, - null: true - end - end -end diff --git a/db/migrate/20190109203902_create_versioned_update_revision.rb b/db/migrate/20190109203902_create_versioned_update_revision.rb deleted file mode 100644 index 56d235305a..0000000000 --- a/db/migrate/20190109203902_create_versioned_update_revision.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateVersionedUpdateRevision < ActiveRecord::Migration[5.2] - def change - create_table :versioned_update_revisions do |t| - t.string :update_type, null: false - t.text :change_note - t.datetime :created_at - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: false, - null: true - end - end -end diff --git a/db/migrate/20190109203921_create_versioned_tags_revision.rb b/db/migrate/20190109203921_create_versioned_tags_revision.rb deleted file mode 100644 index afbe720690..0000000000 --- a/db/migrate/20190109203921_create_versioned_tags_revision.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateVersionedTagsRevision < ActiveRecord::Migration[5.2] - def change - create_table :versioned_tags_revisions do |t| - t.json :tags, default: {}, null: false - t.datetime :created_at - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: false, - null: true - end - end -end diff --git a/db/migrate/20190109204356_use_specific_revisions.rb b/db/migrate/20190109204356_use_specific_revisions.rb deleted file mode 100644 index 452c5a62e9..0000000000 --- a/db/migrate/20190109204356_use_specific_revisions.rb +++ /dev/null @@ -1,41 +0,0 @@ -class UseSpecificRevisions < ActiveRecord::Migration[5.2] - def change - reversible do |dir| - dir.up do - change_table :versioned_revisions, bulk: true do |t| - t.remove :title, :base_path, :summary, :contents, :tags, :change_note, :update_type - end - end - - dir.down do - change_table :versioned_revisions, bulk: true do |t| - t.string :title - t.string :base_path - t.text :summary - t.json :contents, default: {}, null: false - t.json :tags, default: {}, null: false - t.text :change_note - t.string :update_type, null: false - end - end - end - - change_table :versioned_revisions, bulk: true do |t| - t.references :content_revision, - foreign_key: { to_table: :versioned_content_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :update_revision, - foreign_key: { to_table: :versioned_update_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :tags_revision, - foreign_key: { to_table: :versioned_tags_revisions, - on_delete: :restrict }, - index: true, - null: false - end - end -end diff --git a/db/migrate/20190110135826_create_versioned_removal.rb b/db/migrate/20190110135826_create_versioned_removal.rb deleted file mode 100644 index 3a23c5cd1b..0000000000 --- a/db/migrate/20190110135826_create_versioned_removal.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateVersionedRemoval < ActiveRecord::Migration[5.2] - def change - create_table :versioned_removals do |t| - t.string :explanatory_note - t.string :alternative_path - t.boolean :redirect, default: false - - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20190110135834_create_versioned_retirement.rb b/db/migrate/20190110135834_create_versioned_retirement.rb deleted file mode 100644 index 1d024647ba..0000000000 --- a/db/migrate/20190110135834_create_versioned_retirement.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateVersionedRetirement < ActiveRecord::Migration[5.2] - def change - create_table :versioned_retirements do |t| - t.string :explanatory_note - - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20190110145043_add_retire_removal_to_edition_status.rb b/db/migrate/20190110145043_add_retire_removal_to_edition_status.rb deleted file mode 100644 index 5ce07fb6a0..0000000000 --- a/db/migrate/20190110145043_add_retire_removal_to_edition_status.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddRetireRemovalToEditionStatus < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_edition_statuses, - :details, - polymorphic: true, - null: true - end -end diff --git a/db/migrate/20190110213337_create_versioned_internal_note.rb b/db/migrate/20190110213337_create_versioned_internal_note.rb deleted file mode 100644 index d9cccf1607..0000000000 --- a/db/migrate/20190110213337_create_versioned_internal_note.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateVersionedInternalNote < ActiveRecord::Migration[5.2] - def change - create_table :versioned_internal_notes do |t| - t.text :body, null: false - t.references :edition, - foreign_key: { on_delete: :cascade, - to_table: :versioned_editions }, - null: false - t.references :created_by, - foreign_key: { on_delete: :nullify, to_table: :users }, - null: true - - t.datetime :created_at - end - end -end diff --git a/db/migrate/20190110223219_add_preceded_by_to_versioned_revisions.rb b/db/migrate/20190110223219_add_preceded_by_to_versioned_revisions.rb deleted file mode 100644 index 6def65b907..0000000000 --- a/db/migrate/20190110223219_add_preceded_by_to_versioned_revisions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddPrecededByToVersionedRevisions < ActiveRecord::Migration[5.2] - def change - add_reference :versioned_revisions, - :preceded_by, - foreign_key: { on_delete: :nullify, - to_table: :versioned_revisions }, - null: true - end -end diff --git a/db/migrate/20190110225358_remove_edited_at_edited_by_from_document.rb b/db/migrate/20190110225358_remove_edited_at_edited_by_from_document.rb deleted file mode 100644 index 38bb0ae6cd..0000000000 --- a/db/migrate/20190110225358_remove_edited_at_edited_by_from_document.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveEditedAtEditedByFromDocument < ActiveRecord::Migration[5.2] - def up - remove_column :versioned_documents, :last_edited_at - remove_reference :versioned_documents, :last_edited_by - end - - def down - add_column :versioned_documents, - :last_edited_at, - :datetime, - null: false # rubocop:disable Rails/NotNullColumn - add_reference :versioned_documents, - :last_edited_by, - foreign_key: { to_table: :users, on_delete: :nullify }, - index: true - end -end diff --git a/db/migrate/20190110232157_add_first_published_at_to_versioned_documents.rb b/db/migrate/20190110232157_add_first_published_at_to_versioned_documents.rb deleted file mode 100644 index f08e22e909..0000000000 --- a/db/migrate/20190110232157_add_first_published_at_to_versioned_documents.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddFirstPublishedAtToVersionedDocuments < ActiveRecord::Migration[5.2] - def change - add_column :versioned_documents, - :first_published_at, - :datetime, - null: true - end -end diff --git a/db/migrate/20190110233353_rename_edition_statuses.rb b/db/migrate/20190110233353_rename_edition_statuses.rb deleted file mode 100644 index ba451a4a8a..0000000000 --- a/db/migrate/20190110233353_rename_edition_statuses.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameEditionStatuses < ActiveRecord::Migration[5.2] - def change - rename_table :versioned_edition_statuses, :versioned_statuses - end -end diff --git a/db/migrate/20190110233610_rename_edition_status_columns.rb b/db/migrate/20190110233610_rename_edition_status_columns.rb deleted file mode 100644 index 390c63714b..0000000000 --- a/db/migrate/20190110233610_rename_edition_status_columns.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameEditionStatusColumns < ActiveRecord::Migration[5.2] - def change - rename_column :versioned_timeline_entries, :edition_status_id, :status_id - end -end diff --git a/db/migrate/20190110233846_rename_user_facing_state.rb b/db/migrate/20190110233846_rename_user_facing_state.rb deleted file mode 100644 index 2cfbfaab48..0000000000 --- a/db/migrate/20190110233846_rename_user_facing_state.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameUserFacingState < ActiveRecord::Migration[5.2] - def change - rename_column :versioned_statuses, :user_facing_state, :state - end -end diff --git a/db/migrate/20190111104120_update_foreign_key_delete_behaviour.rb b/db/migrate/20190111104120_update_foreign_key_delete_behaviour.rb deleted file mode 100644 index 7f3b6d3e2b..0000000000 --- a/db/migrate/20190111104120_update_foreign_key_delete_behaviour.rb +++ /dev/null @@ -1,47 +0,0 @@ -class UpdateForeignKeyDeleteBehaviour < ActiveRecord::Migration[5.2] - def up - remove_foreign_key :versioned_statuses, column: :edition_id - - add_foreign_key :versioned_statuses, - :versioned_editions, - column: :edition_id, - on_delete: :cascade - - remove_foreign_key :versioned_edition_revisions, column: :edition_id - - add_foreign_key :versioned_edition_revisions, - :versioned_editions, - column: :edition_id, - on_delete: :cascade - - remove_foreign_key :versioned_edition_revisions, column: :revision_id - - add_foreign_key :versioned_edition_revisions, - :versioned_revisions, - column: :revision_id, - on_delete: :cascade - end - - def down - remove_foreign_key :versioned_statuses, column: :edition_id - - add_foreign_key :versioned_statuses, - :versioned_editions, - column: :edition_id, - on_delete: :restrict - - remove_foreign_key :versioned_edition_revisions, column: :edition_id - - add_foreign_key :versioned_edition_revisions, - :versioned_editions, - column: :edition_id, - on_delete: :restrict - - remove_foreign_key :versioned_edition_revisions, column: :revision_id - - add_foreign_key :versioned_edition_revisions, - :versioned_revisions, - column: :revision_id, - on_delete: :restrict - end -end diff --git a/db/migrate/20190111235106_add_number_to_versioned_revision.rb b/db/migrate/20190111235106_add_number_to_versioned_revision.rb deleted file mode 100644 index 5c583b5432..0000000000 --- a/db/migrate/20190111235106_add_number_to_versioned_revision.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddNumberToVersionedRevision < ActiveRecord::Migration[5.2] - def change - add_column :versioned_revisions, - :number, - :integer, - null: false # rubocop:disable Rails/NotNullColumn - add_index :versioned_revisions, %i[number document_id], unique: true - end -end diff --git a/db/migrate/20190113113229_create_versioned_revision_statuses.rb b/db/migrate/20190113113229_create_versioned_revision_statuses.rb deleted file mode 100644 index f85ddc419f..0000000000 --- a/db/migrate/20190113113229_create_versioned_revision_statuses.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateVersionedRevisionStatuses < ActiveRecord::Migration[5.2] - def change - create_table :versioned_revision_statuses do |t| - t.references :revision, - foreign_key: { to_table: :versioned_revisions, - on_delete: :cascade }, - index: true, - null: false - t.references :status, - foreign_key: { to_table: :versioned_statuses, - on_delete: :cascade }, - index: true, - null: false - - t.datetime :created_at, null: false - - t.index %i[revision_id status_id], unique: true - end - end -end diff --git a/db/migrate/20190113115603_remove_versioned_edition_revisions.rb b/db/migrate/20190113115603_remove_versioned_edition_revisions.rb deleted file mode 100644 index e5d89a5ee7..0000000000 --- a/db/migrate/20190113115603_remove_versioned_edition_revisions.rb +++ /dev/null @@ -1,24 +0,0 @@ -class RemoveVersionedEditionRevisions < ActiveRecord::Migration[5.2] - def up - drop_table :versioned_edition_revisions - end - - def down - create_table :versioned_edition_revisions do |t| - t.references :edition, - foreign_key: { to_table: :versioned_editions, - on_delete: :cascade }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, - on_delete: :cascade }, - index: true, - null: false - - t.datetime :created_at, null: false - - t.index %i[edition_id revision_id], unique: true - end - end -end diff --git a/db/migrate/20190116194130_cascade_image_revision_joins_on_revision_delete.rb b/db/migrate/20190116194130_cascade_image_revision_joins_on_revision_delete.rb deleted file mode 100644 index 847a61701c..0000000000 --- a/db/migrate/20190116194130_cascade_image_revision_joins_on_revision_delete.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CascadeImageRevisionJoinsOnRevisionDelete < ActiveRecord::Migration[5.2] - def up - remove_foreign_key :versioned_revision_image_revisions, - column: :revision_id - - add_foreign_key :versioned_revision_image_revisions, - :versioned_revisions, - column: :revision_id, - on_delete: :cascade - end - - def down - remove_foreign_key :versioned_revision_image_revisions, - column: :revision_id - - add_foreign_key :versioned_revision_image_revisions, - :versioned_revisions, - column: :revision_id, - on_delete: :restrict - end -end diff --git a/db/migrate/20190117185910_remove_fields_from_versioned_image_revisions.rb b/db/migrate/20190117185910_remove_fields_from_versioned_image_revisions.rb deleted file mode 100644 index 71ebacecf9..0000000000 --- a/db/migrate/20190117185910_remove_fields_from_versioned_image_revisions.rb +++ /dev/null @@ -1,43 +0,0 @@ -class RemoveFieldsFromVersionedImageRevisions < ActiveRecord::Migration[5.2] - def up - change_table :versioned_image_revisions, bulk: true do |t| - t.remove_references :blob, - foreign_key: { to_table: :active_storage_blobs, - on_delete: :restrict }, - index: true, - null: false - - t.remove :width, - :height, - :crop_x, - :crop_y, - :crop_width, - :crop_height, - :filename, - :caption, - :alt_text, - :credit - end - end - - def down - change_table :versioned_image_revisions, bulk: true do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, - on_delete: :restrict }, - index: true, - null: false - - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.string :filename, null: false - t.string :caption - t.string :alt_text - t.string :credit - end - end -end diff --git a/db/migrate/20190117191135_create_versioned_image_metadata_revision.rb b/db/migrate/20190117191135_create_versioned_image_metadata_revision.rb deleted file mode 100644 index 13be270b5c..0000000000 --- a/db/migrate/20190117191135_create_versioned_image_metadata_revision.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateVersionedImageMetadataRevision < ActiveRecord::Migration[5.2] - def change - create_table :versioned_image_metadata_revisions do |t| - t.string :caption - t.string :alt_text - t.string :credit - t.datetime :created_at - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: false, - null: true - end - end -end diff --git a/db/migrate/20190117191532_create_versioned_image_file_revision.rb b/db/migrate/20190117191532_create_versioned_image_file_revision.rb deleted file mode 100644 index 1063a78580..0000000000 --- a/db/migrate/20190117191532_create_versioned_image_file_revision.rb +++ /dev/null @@ -1,24 +0,0 @@ -class CreateVersionedImageFileRevision < ActiveRecord::Migration[5.2] - def change - create_table :versioned_image_file_revisions do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, - on_delete: :restrict }, - index: true, - null: false - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :nullify }, - index: false, - null: true - t.integer :width, null: false - t.integer :height, null: false - t.integer :crop_x, null: false - t.integer :crop_y, null: false - t.integer :crop_width, null: false - t.integer :crop_height, null: false - t.string :filename, null: false - t.datetime :created_at - end - end -end diff --git a/db/migrate/20190117191703_create_versioned_image_asset.rb b/db/migrate/20190117191703_create_versioned_image_asset.rb deleted file mode 100644 index 2b91190bff..0000000000 --- a/db/migrate/20190117191703_create_versioned_image_asset.rb +++ /dev/null @@ -1,27 +0,0 @@ -class CreateVersionedImageAsset < ActiveRecord::Migration[5.2] - def change - create_table :versioned_image_assets do |t| - t.references :file_revision, - foreign_key: { to_table: :versioned_image_file_revisions, - on_delete: :cascade }, - index: true, - null: false - - t.references :superseded_by, - foreign_key: { to_table: :versioned_image_assets, - on_delete: :nullify }, - index: false, - null: true - - t.string :variant, null: false - t.string :file_url - t.string :state, default: "absent", null: false - t.timestamps - - t.index :file_url, unique: true - t.index %i[file_revision_id variant], - unique: true, - name: "index_versioned_image_asset_unique_variant" - end - end -end diff --git a/db/migrate/20190117192919_add_metadata_and_file_revisions_to_image_revision.rb b/db/migrate/20190117192919_add_metadata_and_file_revisions_to_image_revision.rb deleted file mode 100644 index 8929da8073..0000000000 --- a/db/migrate/20190117192919_add_metadata_and_file_revisions_to_image_revision.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddMetadataAndFileRevisionsToImageRevision < ActiveRecord::Migration[5.2] - def change - change_table :versioned_image_revisions, bulk: true do |t| - t.references :file_revision, - foreign_key: { to_table: :versioned_image_file_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :metadata_revision, - foreign_key: { to_table: :versioned_image_metadata_revisions, - on_delete: :restrict }, - index: true, - null: false - end - end -end diff --git a/db/migrate/20190117193116_remove_asset_manager_tables.rb b/db/migrate/20190117193116_remove_asset_manager_tables.rb deleted file mode 100644 index 718049d710..0000000000 --- a/db/migrate/20190117193116_remove_asset_manager_tables.rb +++ /dev/null @@ -1,47 +0,0 @@ -class RemoveAssetManagerTables < ActiveRecord::Migration[5.2] - def up - drop_table :versioned_asset_manager_image_variants - drop_table :versioned_asset_manager_files - end - - def down - create_table :versioned_asset_manager_files do |t| - t.string :file_url - t.string :state, null: false, default: "absent" - t.references :superseded_by, - foreign_key: { to_table: :versioned_asset_manager_files, - on_delete: :nullify }, - index: false, - null: true - t.timestamps - - t.index :file_url, unique: true - end - - create_table :versioned_asset_manager_image_variants do |t| - t.references :image_revision, - foreign_key: { to_table: :versioned_image_revisions, - on_delete: :cascade }, - index: false, - null: false - - t.references :asset_manager_file, - foreign_key: { to_table: :versioned_asset_manager_files, - on_delete: :restrict }, - index: false, - null: false - - t.string :variant, null: false - - t.datetime :created_at, null: false - - t.index %i[image_revision_id asset_manager_file_id], - unique: true, - name: "index_image_revision_asset_manager_variant_ids" - - t.index %i[image_revision_id variant], - unique: true, - name: "index_image_revision_asset_manager_variant_unique_variant" - end - end -end diff --git a/db/migrate/20190118102825_reinstate_versioned_edition_revisions.rb b/db/migrate/20190118102825_reinstate_versioned_edition_revisions.rb deleted file mode 100644 index 1db2b43123..0000000000 --- a/db/migrate/20190118102825_reinstate_versioned_edition_revisions.rb +++ /dev/null @@ -1,18 +0,0 @@ -class ReinstateVersionedEditionRevisions < ActiveRecord::Migration[5.2] - def change - create_table :versioned_edition_revisions do |t| - t.references :edition, - foreign_key: { to_table: :versioned_editions, - on_delete: :cascade }, - index: true, - null: false - t.references :revision, - foreign_key: { to_table: :versioned_revisions, - on_delete: :cascade }, - index: true, - null: false - t.datetime :created_at, null: false - t.index %i[edition_id revision_id], unique: true - end - end -end diff --git a/db/migrate/20190118121447_add_revision_synced_to_versioned_editions.rb b/db/migrate/20190118121447_add_revision_synced_to_versioned_editions.rb deleted file mode 100644 index f22a54f2a6..0000000000 --- a/db/migrate/20190118121447_add_revision_synced_to_versioned_editions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddRevisionSyncedToVersionedEditions < ActiveRecord::Migration[5.2] - def change - add_column :versioned_editions, - :revision_synced, - :boolean, - null: false, - default: false - end -end diff --git a/db/migrate/20190118151754_remove_draft_from_versioned_edition.rb b/db/migrate/20190118151754_remove_draft_from_versioned_edition.rb deleted file mode 100644 index 8da45f51fa..0000000000 --- a/db/migrate/20190118151754_remove_draft_from_versioned_edition.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RemoveDraftFromVersionedEdition < ActiveRecord::Migration[5.2] - def change - remove_column :versioned_editions, - :draft, - :string, - null: false - end -end diff --git a/db/migrate/20190121180333_drop_versions.rb b/db/migrate/20190121180333_drop_versions.rb deleted file mode 100644 index 1a26f1f89f..0000000000 --- a/db/migrate/20190121180333_drop_versions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropVersions < ActiveRecord::Migration[5.2] - def change - drop_table :versions # rubocop:disable Rails/ReversibleMigration - end -end diff --git a/db/migrate/20190122104549_delete_pre_versioning_tables.rb b/db/migrate/20190122104549_delete_pre_versioning_tables.rb deleted file mode 100644 index d7b44f189e..0000000000 --- a/db/migrate/20190122104549_delete_pre_versioning_tables.rb +++ /dev/null @@ -1,21 +0,0 @@ -class DeletePreVersioningTables < ActiveRecord::Migration[5.2] - def change - remove_foreign_key :documents, :images - remove_foreign_key :documents, :users - remove_foreign_key :images, :active_storage_blobs - remove_foreign_key :images, :documents - remove_foreign_key :internal_notes, :timeline_entries - remove_foreign_key :internal_notes, :documents - remove_foreign_key :removals, :timeline_entries - remove_foreign_key :retirements, :timeline_entries - remove_foreign_key :timeline_entries, :documents - remove_foreign_key :timeline_entries, :users - - drop_table :documents # rubocop:disable Rails/ReversibleMigration - drop_table :images # rubocop:disable Rails/ReversibleMigration - drop_table :internal_notes # rubocop:disable Rails/ReversibleMigration - drop_table :removals # rubocop:disable Rails/ReversibleMigration - drop_table :retirements # rubocop:disable Rails/ReversibleMigration - drop_table :timeline_entries # rubocop:disable Rails/ReversibleMigration - end -end diff --git a/db/migrate/20190123105011_restrict_delete_for_all_foreign_keys.rb b/db/migrate/20190123105011_restrict_delete_for_all_foreign_keys.rb deleted file mode 100644 index 7ff3aa5694..0000000000 --- a/db/migrate/20190123105011_restrict_delete_for_all_foreign_keys.rb +++ /dev/null @@ -1,121 +0,0 @@ -class RestrictDeleteForAllForeignKeys < ActiveRecord::Migration[5.2] - def up - remove_foreign_key "versioned_content_revisions", column: "created_by_id" - remove_foreign_key "versioned_documents", column: "created_by_id" - remove_foreign_key "versioned_edition_revisions", column: "edition_id" - remove_foreign_key "versioned_edition_revisions", column: "revision_id" - remove_foreign_key "versioned_editions", column: "created_by_id" - remove_foreign_key "versioned_editions", column: "last_edited_by_id" - remove_foreign_key "versioned_image_assets", column: "superseded_by_id" - remove_foreign_key "versioned_image_assets", column: "file_revision_id" - remove_foreign_key "versioned_image_file_revisions", column: "created_by_id" - remove_foreign_key "versioned_image_metadata_revisions", column: "created_by_id" - remove_foreign_key "versioned_image_revisions", column: "created_by_id" - remove_foreign_key "versioned_images", column: "created_by_id" - remove_foreign_key "versioned_internal_notes", column: "created_by_id" - remove_foreign_key "versioned_internal_notes", column: "edition_id" - remove_foreign_key "versioned_revision_image_revisions", column: "revision_id" - remove_foreign_key "versioned_revision_statuses", column: "revision_id" - remove_foreign_key "versioned_revision_statuses", column: "status_id" - remove_foreign_key "versioned_revisions", column: "created_by_id" - remove_foreign_key "versioned_revisions", column: "preceded_by_id" - remove_foreign_key "versioned_statuses", column: "created_by_id" - remove_foreign_key "versioned_statuses", column: "edition_id" - remove_foreign_key "versioned_tags_revisions", column: "created_by_id" - remove_foreign_key "versioned_timeline_entries", column: "created_by_id" - remove_foreign_key "versioned_timeline_entries", column: "document_id" - remove_foreign_key "versioned_timeline_entries", column: "edition_id" - remove_foreign_key "versioned_timeline_entries", column: "revision_id" - remove_foreign_key "versioned_timeline_entries", column: "status_id" - remove_foreign_key "versioned_update_revisions", column: "created_by_id" - - add_foreign_key "versioned_content_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_documents", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_edition_revisions", "versioned_editions", column: "edition_id", on_delete: :restrict - add_foreign_key "versioned_edition_revisions", "versioned_revisions", column: "revision_id", on_delete: :restrict - add_foreign_key "versioned_editions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_editions", "users", column: "last_edited_by_id", on_delete: :restrict - add_foreign_key "versioned_image_assets", "versioned_image_assets", column: "superseded_by_id", on_delete: :restrict - add_foreign_key "versioned_image_assets", "versioned_image_file_revisions", column: "file_revision_id", on_delete: :restrict - add_foreign_key "versioned_image_file_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_image_metadata_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_image_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_images", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_internal_notes", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_internal_notes", "versioned_editions", column: "edition_id", on_delete: :restrict - add_foreign_key "versioned_revision_image_revisions", "versioned_revisions", column: "revision_id", on_delete: :restrict - add_foreign_key "versioned_revision_statuses", "versioned_revisions", column: "revision_id", on_delete: :restrict - add_foreign_key "versioned_revision_statuses", "versioned_statuses", column: "status_id", on_delete: :restrict - add_foreign_key "versioned_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_revisions", "versioned_revisions", column: "preceded_by_id", on_delete: :restrict - add_foreign_key "versioned_statuses", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_statuses", "versioned_editions", column: "edition_id", on_delete: :restrict - add_foreign_key "versioned_tags_revisions", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_timeline_entries", "users", column: "created_by_id", on_delete: :restrict - add_foreign_key "versioned_timeline_entries", "versioned_documents", column: "document_id", on_delete: :restrict - add_foreign_key "versioned_timeline_entries", "versioned_editions", column: "edition_id", on_delete: :restrict - add_foreign_key "versioned_timeline_entries", "versioned_revisions", column: "revision_id", on_delete: :restrict - add_foreign_key "versioned_timeline_entries", "versioned_statuses", column: "status_id", on_delete: :restrict - add_foreign_key "versioned_update_revisions", "users", column: "created_by_id", on_delete: :restrict - end - - def down - remove_foreign_key "versioned_content_revisions", column: "created_by_id" - remove_foreign_key "versioned_documents", column: "created_by_id" - remove_foreign_key "versioned_edition_revisions", column: "edition_id" - remove_foreign_key "versioned_edition_revisions", column: "revision_id" - remove_foreign_key "versioned_editions", column: "created_by_id" - remove_foreign_key "versioned_editions", column: "last_edited_by_id" - remove_foreign_key "versioned_image_assets", column: "superseded_by_id" - remove_foreign_key "versioned_image_assets", column: "file_revision_id" - remove_foreign_key "versioned_image_file_revisions", column: "created_by_id" - remove_foreign_key "versioned_image_metadata_revisions", column: "created_by_id" - remove_foreign_key "versioned_image_revisions", column: "created_by_id" - remove_foreign_key "versioned_images", column: "created_by_id" - remove_foreign_key "versioned_internal_notes", column: "created_by_id" - remove_foreign_key "versioned_internal_notes", column: "edition_id" - remove_foreign_key "versioned_revision_image_revisions", column: "revision_id" - remove_foreign_key "versioned_revision_statuses", column: "revision_id" - remove_foreign_key "versioned_revision_statuses", column: "status_id" - remove_foreign_key "versioned_revisions", column: "created_by_id" - remove_foreign_key "versioned_revisions", column: "preceded_by_id" - remove_foreign_key "versioned_statuses", column: "created_by_id" - remove_foreign_key "versioned_statuses", column: "edition_id" - remove_foreign_key "versioned_tags_revisions", column: "created_by_id" - remove_foreign_key "versioned_timeline_entries", column: "created_by_id" - remove_foreign_key "versioned_timeline_entries", column: "document_id" - remove_foreign_key "versioned_timeline_entries", column: "edition_id" - remove_foreign_key "versioned_timeline_entries", column: "revision_id" - remove_foreign_key "versioned_timeline_entries", column: "status_id" - remove_foreign_key "versioned_update_revisions", column: "created_by_id" - - add_foreign_key "versioned_content_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_documents", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_edition_revisions", "versioned_editions", column: "edition_id", on_delete: :cascade - add_foreign_key "versioned_edition_revisions", "versioned_revisions", column: "revision_id", on_delete: :cascade - add_foreign_key "versioned_editions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_editions", "users", column: "last_edited_by_id", on_delete: :nullify - add_foreign_key "versioned_image_assets", "versioned_image_assets", column: "superseded_by_id", on_delete: :nullify - add_foreign_key "versioned_image_assets", "versioned_image_file_revisions", column: "file_revision_id", on_delete: :cascade - add_foreign_key "versioned_image_file_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_image_metadata_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_image_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_images", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_internal_notes", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_internal_notes", "versioned_editions", column: "edition_id", on_delete: :cascade - add_foreign_key "versioned_revision_image_revisions", "versioned_revisions", column: "revision_id", on_delete: :cascade - add_foreign_key "versioned_revision_statuses", "versioned_revisions", column: "revision_id", on_delete: :cascade - add_foreign_key "versioned_revision_statuses", "versioned_statuses", column: "status_id", on_delete: :cascade - add_foreign_key "versioned_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_revisions", "versioned_revisions", column: "preceded_by_id", on_delete: :nullify - add_foreign_key "versioned_statuses", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_statuses", "versioned_editions", column: "edition_id", on_delete: :cascade - add_foreign_key "versioned_tags_revisions", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_timeline_entries", "users", column: "created_by_id", on_delete: :nullify - add_foreign_key "versioned_timeline_entries", "versioned_documents", column: "document_id", on_delete: :cascade - add_foreign_key "versioned_timeline_entries", "versioned_editions", column: "edition_id", on_delete: :cascade - add_foreign_key "versioned_timeline_entries", "versioned_revisions", column: "revision_id", on_delete: :nullify - add_foreign_key "versioned_timeline_entries", "versioned_statuses", column: "status_id", on_delete: :nullify - add_foreign_key "versioned_update_revisions", "users", column: "created_by_id", on_delete: :nullify - end -end diff --git a/db/migrate/20190123112338_remove_versioned_prefix_from_join_tables.rb b/db/migrate/20190123112338_remove_versioned_prefix_from_join_tables.rb deleted file mode 100644 index d29742c263..0000000000 --- a/db/migrate/20190123112338_remove_versioned_prefix_from_join_tables.rb +++ /dev/null @@ -1,7 +0,0 @@ -class RemoveVersionedPrefixFromJoinTables < ActiveRecord::Migration[5.2] - def change - rename_table :versioned_edition_revisions, :editions_revisions - rename_table :versioned_revision_image_revisions, :revisions_image_revisions - rename_table :versioned_revision_statuses, :revisions_statuses - end -end diff --git a/db/migrate/20190123120403_rename_versioned_update_revisions_to_metadata_revisions.rb b/db/migrate/20190123120403_rename_versioned_update_revisions_to_metadata_revisions.rb deleted file mode 100644 index 9324b9f5c9..0000000000 --- a/db/migrate/20190123120403_rename_versioned_update_revisions_to_metadata_revisions.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameVersionedUpdateRevisionsToMetadataRevisions < ActiveRecord::Migration[5.2] - def change - rename_table :versioned_update_revisions, :metadata_revisions - rename_column :versioned_revisions, :update_revision_id, :metadata_revision_id - end -end diff --git a/db/migrate/20190123121145_rename_table_versioned_retirements_to_withdrawals.rb b/db/migrate/20190123121145_rename_table_versioned_retirements_to_withdrawals.rb deleted file mode 100644 index 4f6a38a8eb..0000000000 --- a/db/migrate/20190123121145_rename_table_versioned_retirements_to_withdrawals.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameTableVersionedRetirementsToWithdrawals < ActiveRecord::Migration[5.2] - def change - rename_table :versioned_retirements, :withdrawals - end -end diff --git a/db/migrate/20190123140850_remove_versioned_prefix_from_tables.rb b/db/migrate/20190123140850_remove_versioned_prefix_from_tables.rb deleted file mode 100644 index 70aa892748..0000000000 --- a/db/migrate/20190123140850_remove_versioned_prefix_from_tables.rb +++ /dev/null @@ -1,19 +0,0 @@ -class RemoveVersionedPrefixFromTables < ActiveRecord::Migration[5.2] - def change - rename_table :versioned_content_revisions, :content_revisions - rename_table :versioned_documents, :documents - rename_table :versioned_editions, :editions - rename_table :versioned_timeline_entries, :timeline_entries - rename_table :versioned_revisions, :revisions - rename_table :versioned_tags_revisions, :tags_revisions - rename_table :versioned_statuses, :statuses - rename_table :versioned_removals, :removals - rename_table :versioned_internal_notes, :internal_notes - - rename_table :versioned_images, :images - rename_table :versioned_image_revisions, :image_revisions - rename_table :versioned_image_metadata_revisions, :image_metadata_revisions - rename_table :versioned_image_file_revisions, :image_file_revisions - rename_table :versioned_image_assets, :image_assets - end -end diff --git a/db/migrate/20190123144805_rename_image_assets_file_image_variant_index.rb b/db/migrate/20190123144805_rename_image_assets_file_image_variant_index.rb deleted file mode 100644 index a108c8e6de..0000000000 --- a/db/migrate/20190123144805_rename_image_assets_file_image_variant_index.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameImageAssetsFileImageVariantIndex < ActiveRecord::Migration[5.2] - def change - rename_index :image_assets, "index_versioned_image_asset_unique_variant", "index_image_asset_unique_variant" - end -end diff --git a/db/migrate/20190125181528_remove_editions_current_and_live_indexes.rb b/db/migrate/20190125181528_remove_editions_current_and_live_indexes.rb deleted file mode 100644 index d2761acd01..0000000000 --- a/db/migrate/20190125181528_remove_editions_current_and_live_indexes.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveEditionsCurrentAndLiveIndexes < ActiveRecord::Migration[5.2] - def change - remove_index :editions, :current - remove_index :editions, :live - end -end diff --git a/db/migrate/20190130100821_rename_withdrawal_explanatory_note_to_public_explanation.rb b/db/migrate/20190130100821_rename_withdrawal_explanatory_note_to_public_explanation.rb deleted file mode 100644 index 45b16964b2..0000000000 --- a/db/migrate/20190130100821_rename_withdrawal_explanatory_note_to_public_explanation.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameWithdrawalExplanatoryNoteToPublicExplanation < ActiveRecord::Migration[5.2] - def change - rename_column :withdrawals, :explanatory_note, :public_explanation - change_column_null :withdrawals, :public_explanation, false - end -end diff --git a/db/migrate/20190201144717_add_published_status_to_withdrawals.rb b/db/migrate/20190201144717_add_published_status_to_withdrawals.rb deleted file mode 100644 index e6eecdba3f..0000000000 --- a/db/migrate/20190201144717_add_published_status_to_withdrawals.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddPublishedStatusToWithdrawals < ActiveRecord::Migration[5.2] - def change - add_reference :withdrawals, - :published_status, - foreign_key: { to_table: :statuses, on_delete: :restrict }, - index: false, - null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20190207183954_add_withdrawn_at_to_withdrawal.rb b/db/migrate/20190207183954_add_withdrawn_at_to_withdrawal.rb deleted file mode 100644 index 0c8c466a5a..0000000000 --- a/db/migrate/20190207183954_add_withdrawn_at_to_withdrawal.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWithdrawnAtToWithdrawal < ActiveRecord::Migration[5.2] - def change - add_column :withdrawals, :withdrawn_at, :datetime, null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20190212110438_rename_image_timeline_entry_types.rb b/db/migrate/20190212110438_rename_image_timeline_entry_types.rb deleted file mode 100644 index 9e7eb7d133..0000000000 --- a/db/migrate/20190212110438_rename_image_timeline_entry_types.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RenameImageTimelineEntryTypes < ActiveRecord::Migration[5.2] - def up - TimelineEntry.where(entry_type: "lead_image_updated") - .update_all(entry_type: "lead_image_selected") - - TimelineEntry.where(entry_type: "image_removed") - .update_all(entry_type: "image_deleted") - end - - def down - TimelineEntry.where(entry_type: "lead_image_selected") - .update_all(entry_type: "lead_image_updated") - - TimelineEntry.where(entry_type: "image_deleted") - .update_all(entry_type: "image_removed") - end -end diff --git a/db/migrate/20190214120136_add_schedule_date_to_metadata_revision.rb b/db/migrate/20190214120136_add_schedule_date_to_metadata_revision.rb deleted file mode 100644 index c200b7c9eb..0000000000 --- a/db/migrate/20190214120136_add_schedule_date_to_metadata_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddScheduleDateToMetadataRevision < ActiveRecord::Migration[5.2] - def change - add_column :metadata_revisions, :scheduled_publishing_datetime, :datetime - end -end diff --git a/db/migrate/20190225133030_create_scheduling.rb b/db/migrate/20190225133030_create_scheduling.rb deleted file mode 100644 index 402abf7a56..0000000000 --- a/db/migrate/20190225133030_create_scheduling.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateScheduling < ActiveRecord::Migration[5.2] - def change - create_table :schedulings do |t| - t.boolean :reviewed, default: false - t.datetime :created_at, null: false - t.references :pre_scheduled_status, - foreign_key: { to_table: :statuses, on_delete: :restrict }, - index: false, - null: false - end - end -end diff --git a/db/migrate/20190415124810_create_file_attachment.rb b/db/migrate/20190415124810_create_file_attachment.rb deleted file mode 100644 index 8817e7470f..0000000000 --- a/db/migrate/20190415124810_create_file_attachment.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateFileAttachment < ActiveRecord::Migration[5.2] - def change - create_table :file_attachments do |t| - t.datetime :created_at, null: false - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :restrict }, - index: false - end - end -end diff --git a/db/migrate/20190415125457_create_file_attachment_revisions.rb b/db/migrate/20190415125457_create_file_attachment_revisions.rb deleted file mode 100644 index b482651c44..0000000000 --- a/db/migrate/20190415125457_create_file_attachment_revisions.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateFileAttachmentRevisions < ActiveRecord::Migration[5.2] - def change - create_table :file_attachment_revisions do |t| - t.datetime :created_at, null: false - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :restrict }, - index: false - t.references :file_attachment, - foreign_key: { to_table: :file_attachments, - on_delete: :restrict }, - null: false - end - end -end diff --git a/db/migrate/20190415135406_add_attachment_file_metadata_revision.rb b/db/migrate/20190415135406_add_attachment_file_metadata_revision.rb deleted file mode 100644 index e7e23cdfdb..0000000000 --- a/db/migrate/20190415135406_add_attachment_file_metadata_revision.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddAttachmentFileMetadataRevision < ActiveRecord::Migration[5.2] - def change - create_table :file_attachment_metadata_revisions do |t| - t.datetime :created_at, null: false - t.string :title, null: false - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :restrict }, - index: false - end - end -end diff --git a/db/migrate/20190415141144_add_file_attachment_file_revision.rb b/db/migrate/20190415141144_add_file_attachment_file_revision.rb deleted file mode 100644 index 531f773960..0000000000 --- a/db/migrate/20190415141144_add_file_attachment_file_revision.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddFileAttachmentFileRevision < ActiveRecord::Migration[5.2] - def change - create_table :file_attachment_file_revisions do |t| - t.references :blob, - foreign_key: { to_table: :active_storage_blobs, - on_delete: :restrict }, - index: true, - null: false - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :restrict }, - index: false - t.string :filename, null: false - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20190415144101_add_revision_references_to_file_attachment_revision.rb b/db/migrate/20190415144101_add_revision_references_to_file_attachment_revision.rb deleted file mode 100644 index d4852d899d..0000000000 --- a/db/migrate/20190415144101_add_revision_references_to_file_attachment_revision.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddRevisionReferencesToFileAttachmentRevision < ActiveRecord::Migration[5.2] - def change - change_table :file_attachment_revisions, bulk: true do |t| - t.references :file_revision, - foreign_key: { to_table: :file_attachment_file_revisions, - on_delete: :restrict }, - index: true, - null: false - t.references :metadata_revision, - foreign_key: { to_table: :file_attachment_metadata_revisions, - on_delete: :restrict }, - index: true, - null: false - end - end -end diff --git a/db/migrate/20190415144526_create_revisions_file_attachment_revisions.rb b/db/migrate/20190415144526_create_revisions_file_attachment_revisions.rb deleted file mode 100644 index c2a17503c9..0000000000 --- a/db/migrate/20190415144526_create_revisions_file_attachment_revisions.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateRevisionsFileAttachmentRevisions < ActiveRecord::Migration[5.2] - def change - create_table :revisions_file_attachment_revisions do |t| - t.references :file_attachment_revision, - foreign_key: { to_table: :file_attachment_revisions, - on_delete: :restrict }, - index: { name: :index_revisions_file_attachment_on_file_attachment_revision_id }, - null: false - t.references :revision, - foreign_key: { to_table: :revisions, - on_delete: :restrict }, - index: true, - null: false - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20190416075600_create_file_attachment_asset.rb b/db/migrate/20190416075600_create_file_attachment_asset.rb deleted file mode 100644 index 24b130f16a..0000000000 --- a/db/migrate/20190416075600_create_file_attachment_asset.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateFileAttachmentAsset < ActiveRecord::Migration[5.2] - def change - create_table :file_attachment_assets do |t| - t.references :file_revision, - foreign_key: { to_table: :file_attachment_file_revisions, - on_delete: :restrict }, - index: true, - null: false - - t.string :variant, default: "file", null: false - t.string :file_url - t.string :state, default: "absent", null: false - t.timestamps - - t.index :file_url, unique: true - t.index %i[file_revision_id variant], - unique: true - end - end -end diff --git a/db/migrate/20190417133100_add_size_to_file_attachment_file_revision.rb b/db/migrate/20190417133100_add_size_to_file_attachment_file_revision.rb deleted file mode 100644 index 5e7a0a66fc..0000000000 --- a/db/migrate/20190417133100_add_size_to_file_attachment_file_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSizeToFileAttachmentFileRevision < ActiveRecord::Migration[5.2] - def change - add_column :file_attachment_file_revisions, :size, :bigint, null: false # rubocop:disable Rails/NotNullColumn - end -end diff --git a/db/migrate/20190424145213_rename_file_revision_to_blob_revision.rb b/db/migrate/20190424145213_rename_file_revision_to_blob_revision.rb deleted file mode 100644 index 378bff0572..0000000000 --- a/db/migrate/20190424145213_rename_file_revision_to_blob_revision.rb +++ /dev/null @@ -1,12 +0,0 @@ -class RenameFileRevisionToBlobRevision < ActiveRecord::Migration[5.2] - def change - rename_table :file_attachment_file_revisions, :file_attachment_blob_revisions - rename_table :image_file_revisions, :image_blob_revisions - - rename_column :image_revisions, :file_revision_id, :blob_revision_id - rename_column :file_attachment_revisions, :file_revision_id, :blob_revision_id - - rename_column :image_assets, :file_revision_id, :blob_revision_id - rename_column :file_attachment_assets, :file_revision_id, :blob_revision_id - end -end diff --git a/db/migrate/20190426090323_add_superseded_by_to_file_attachment_assets.rb b/db/migrate/20190426090323_add_superseded_by_to_file_attachment_assets.rb deleted file mode 100644 index 3f28789a0c..0000000000 --- a/db/migrate/20190426090323_add_superseded_by_to_file_attachment_assets.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddSupersededByToFileAttachmentAssets < ActiveRecord::Migration[5.2] - def change - add_reference :file_attachment_assets, - :superseded_by, - foreign_key: { to_table: :file_attachment_assets, - on_delete: :restrict }, - index: false, - null: true - end -end diff --git a/db/migrate/20190430091427_remove_redundant_file_attachment_size.rb b/db/migrate/20190430091427_remove_redundant_file_attachment_size.rb deleted file mode 100644 index e756a27949..0000000000 --- a/db/migrate/20190430091427_remove_redundant_file_attachment_size.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveRedundantFileAttachmentSize < ActiveRecord::Migration[5.2] - def change - remove_column :file_attachment_blob_revisions, :size # rubocop:disable Rails/ReversibleMigration - end -end diff --git a/db/migrate/20190501145759_add_number_of_pages_to_file_attachment_blob_revision.rb b/db/migrate/20190501145759_add_number_of_pages_to_file_attachment_blob_revision.rb deleted file mode 100644 index 743740d5fd..0000000000 --- a/db/migrate/20190501145759_add_number_of_pages_to_file_attachment_blob_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNumberOfPagesToFileAttachmentBlobRevision < ActiveRecord::Migration[5.2] - def change - add_column :file_attachment_blob_revisions, :number_of_pages, :integer - end -end diff --git a/db/migrate/20190530175303_remove_variant_from_file_attachment_assets.rb b/db/migrate/20190530175303_remove_variant_from_file_attachment_assets.rb deleted file mode 100644 index f18f3d77d1..0000000000 --- a/db/migrate/20190530175303_remove_variant_from_file_attachment_assets.rb +++ /dev/null @@ -1,15 +0,0 @@ -class RemoveVariantFromFileAttachmentAssets < ActiveRecord::Migration[5.2] - def change - remove_index :file_attachment_assets, - column: %i[blob_revision_id variant], - unique: true - remove_column :file_attachment_assets, - :variant, - :string, - default: "file", - null: false - - remove_index :file_attachment_assets, :blob_revision_id - add_index :file_attachment_assets, :blob_revision_id, unique: true - end -end diff --git a/db/migrate/20190612153007_add_publish_time_field_to_scheduling.rb b/db/migrate/20190612153007_add_publish_time_field_to_scheduling.rb deleted file mode 100644 index df0c97a39b..0000000000 --- a/db/migrate/20190612153007_add_publish_time_field_to_scheduling.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddPublishTimeFieldToScheduling < ActiveRecord::Migration[5.2] - def change - # This migration has a default value so that we can set it to be nil false - # and have it not break places where there are already schedulings - # (integration / dev environments) as scheduling is not a feature used in - # production this will have no effect there. - add_column :schedulings, # rubocop:disable Rails/BulkChangeTable - :publish_time, - :datetime, - default: -> { "CURRENT_TIMESTAMP" }, - null: false - - # This sets the column back to a default of nil - change_column_default :schedulings, - :publish_time, - from: -> { "CURRENT_TIMESTAMP" }, - to: nil - end -end diff --git a/db/migrate/20190612160520_rename_scheduled_publishing_datetime.rb b/db/migrate/20190612160520_rename_scheduled_publishing_datetime.rb deleted file mode 100644 index cd871d67a4..0000000000 --- a/db/migrate/20190612160520_rename_scheduled_publishing_datetime.rb +++ /dev/null @@ -1,7 +0,0 @@ -class RenameScheduledPublishingDatetime < ActiveRecord::Migration[5.2] - def change - rename_column :metadata_revisions, - :scheduled_publishing_datetime, - :proposed_publish_time - end -end diff --git a/db/migrate/20190617142340_add_backdated_to_to_metadata_revision.rb b/db/migrate/20190617142340_add_backdated_to_to_metadata_revision.rb deleted file mode 100644 index 9e319f2d46..0000000000 --- a/db/migrate/20190617142340_add_backdated_to_to_metadata_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBackdatedToToMetadataRevision < ActiveRecord::Migration[5.2] - def change - add_column :metadata_revisions, :backdated_to, :datetime - end -end diff --git a/db/migrate/20190626155821_create_access_limits.rb b/db/migrate/20190626155821_create_access_limits.rb deleted file mode 100644 index 16a40dbd4e..0000000000 --- a/db/migrate/20190626155821_create_access_limits.rb +++ /dev/null @@ -1,32 +0,0 @@ -class CreateAccessLimits < ActiveRecord::Migration[5.2] - def change - create_table :access_limits do |t| - t.datetime :created_at - - t.references :created_by, - foreign_key: { to_table: :users, - on_delete: :restrict }, - index: false - - t.references :edition, - foreign_key: { to_table: :editions, - on_delete: :restrict }, - null: false, - index: false - - t.references :revision_at_creation, - foreign_key: { to_table: :revisions, - on_delete: :restrict }, - null: false, - index: false - - t.string :limit_type, null: false - end - - add_reference :editions, - :access_limit, - foreign_key: { on_delete: :restrict }, - null: true, - index: true - end -end diff --git a/db/migrate/20190717170541_allow_edition_deletion.rb b/db/migrate/20190717170541_allow_edition_deletion.rb deleted file mode 100644 index b9bb787789..0000000000 --- a/db/migrate/20190717170541_allow_edition_deletion.rb +++ /dev/null @@ -1,65 +0,0 @@ -class AllowEditionDeletion < ActiveRecord::Migration[5.2] - def up - remove_foreign_key :access_limits, :editions - add_foreign_key :access_limits, - :editions, - on_delete: :cascade - - remove_foreign_key :editions_revisions, :editions - add_foreign_key :editions_revisions, - :editions, - on_delete: :cascade - - remove_foreign_key :statuses, :editions - add_foreign_key :statuses, - :editions, - on_delete: :cascade - - remove_foreign_key :revisions_statuses, :statuses - add_foreign_key :revisions_statuses, - :statuses, - on_delete: :cascade - - remove_foreign_key :internal_notes, :editions - add_foreign_key :internal_notes, - :editions, - on_delete: :cascade - - remove_foreign_key :timeline_entries, :editions - add_foreign_key :timeline_entries, - :editions, - on_delete: :cascade - end - - def down - remove_foreign_key :access_limits, :editions - add_foreign_key :access_limits, - :editions, - on_delete: :restrict - - remove_foreign_key :editions_revisions, :editions - add_foreign_key :editions_revisions, - :editions, - on_delete: :restrict - - remove_foreign_key :statuses, :editions - add_foreign_key :statuses, - :editions, - on_delete: :restrict - - remove_foreign_key :revisions_statuses, :statuses - add_foreign_key :revisions_statuses, - :statuses, - on_delete: :restrict - - remove_foreign_key :internal_notes, :editions - add_foreign_key :internal_notes, - :editions, - on_delete: :restrict - - remove_foreign_key :timeline_entries, :editions - add_foreign_key :timeline_entries, - :editions, - on_delete: :restrict - end -end diff --git a/db/migrate/20190717203348_allow_revision_deletion.rb b/db/migrate/20190717203348_allow_revision_deletion.rb deleted file mode 100644 index 2670bc1088..0000000000 --- a/db/migrate/20190717203348_allow_revision_deletion.rb +++ /dev/null @@ -1,73 +0,0 @@ -class AllowRevisionDeletion < ActiveRecord::Migration[5.2] - def up - remove_foreign_key :revisions_image_revisions, :revisions - add_foreign_key :revisions_image_revisions, - :revisions, - on_delete: :cascade - - remove_foreign_key :image_assets, :image_blob_revisions - add_foreign_key :image_assets, - :image_blob_revisions, - column: :blob_revision_id, - on_delete: :cascade - - remove_foreign_key :image_assets, :image_assets - add_foreign_key :image_assets, - :image_assets, - column: :superseded_by_id, - on_delete: :nullify - - remove_foreign_key :revisions_file_attachment_revisions, :revisions - add_foreign_key :revisions_file_attachment_revisions, - :revisions, - on_delete: :cascade - - remove_foreign_key :file_attachment_assets, :file_attachment_blob_revisions - add_foreign_key :file_attachment_assets, - :file_attachment_blob_revisions, - column: :blob_revision_id, - on_delete: :cascade - - remove_foreign_key :file_attachment_assets, :file_attachment_assets - add_foreign_key :file_attachment_assets, - :file_attachment_assets, - column: :superseded_by_id, - on_delete: :nullify - end - - def down - remove_foreign_key :revisions_image_revisions, :revisions - add_foreign_key :revisions_image_revisions, - :revisions, - on_delete: :restrict - - remove_foreign_key :image_assets, :image_blob_revisions - add_foreign_key :image_assets, - :image_blob_revisions, - column: :blob_revision_id, - on_delete: :restrict - - remove_foreign_key :image_assets, :image_assets - add_foreign_key :image_assets, - :image_assets, - column: :superseded_by_id, - on_delete: :restrict - - remove_foreign_key :revisions_file_attachment_revisions, :revisions - add_foreign_key :revisions_file_attachment_revisions, - :revisions, - on_delete: :restrict - - remove_foreign_key :file_attachment_assets, :file_attachment_blob_revisions - add_foreign_key :file_attachment_assets, - :file_attachment_blob_revisions, - column: :blob_revision_id, - on_delete: :restrict - - remove_foreign_key :file_attachment_assets, :file_attachment_assets - add_foreign_key :file_attachment_assets, - :file_attachment_assets, - column: :superseded_by_id, - on_delete: :restrict - end -end diff --git a/db/migrate/20190729145805_add_whitehall_import.rb b/db/migrate/20190729145805_add_whitehall_import.rb deleted file mode 100644 index 719cec263b..0000000000 --- a/db/migrate/20190729145805_add_whitehall_import.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddWhitehallImport < ActiveRecord::Migration[5.2] - def change - create_table :whitehall_imports do |t| - t.bigint :whitehall_document_id, null: false - t.json :payload, null: false - t.uuid :content_id, null: false - t.string :state, null: false - t.text :error_log - t.timestamps - end - end -end diff --git a/db/migrate/20191030085853_add_imported_from_to_document.rb b/db/migrate/20191030085853_add_imported_from_to_document.rb deleted file mode 100644 index e407f534a3..0000000000 --- a/db/migrate/20191030085853_add_imported_from_to_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImportedFromToDocument < ActiveRecord::Migration[5.2] - def change - add_column :documents, :imported_from, :string - end -end diff --git a/db/migrate/20191030093601_add_imported_to_revision.rb b/db/migrate/20191030093601_add_imported_to_revision.rb deleted file mode 100644 index e4f6575d68..0000000000 --- a/db/migrate/20191030093601_add_imported_to_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImportedToRevision < ActiveRecord::Migration[5.2] - def change - add_column :revisions, :imported, :boolean, default: false - end -end diff --git a/db/migrate/20191104131759_add_document_type_id_to_metadata_revisions.rb b/db/migrate/20191104131759_add_document_type_id_to_metadata_revisions.rb deleted file mode 100644 index 7646a48b27..0000000000 --- a/db/migrate/20191104131759_add_document_type_id_to_metadata_revisions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDocumentTypeIdToMetadataRevisions < ActiveRecord::Migration[5.2] - def change - add_column :metadata_revisions, :document_type_id, :string - end -end diff --git a/db/migrate/20191106095154_populate_document_type_id_in_metadata_revisions.rb b/db/migrate/20191106095154_populate_document_type_id_in_metadata_revisions.rb deleted file mode 100644 index 071b96c07e..0000000000 --- a/db/migrate/20191106095154_populate_document_type_id_in_metadata_revisions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class PopulateDocumentTypeIdInMetadataRevisions < ActiveRecord::Migration[5.2] - def up - type_doc_ids_hash = Document.group(:document_type_id).pluck(:document_type_id, "ARRAY_AGG(id)").to_h - - type_doc_ids_hash.each do |type, ids| - MetadataRevision.joins("INNER JOIN revisions ON metadata_revisions.id = revisions.id") - .where("revisions.document_id": ids).update_all(document_type_id: type) - end - end -end diff --git a/db/migrate/20191106152405_allow_null_on_document_document_type_id.rb b/db/migrate/20191106152405_allow_null_on_document_document_type_id.rb deleted file mode 100644 index b1bc851945..0000000000 --- a/db/migrate/20191106152405_allow_null_on_document_document_type_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AllowNullOnDocumentDocumentTypeId < ActiveRecord::Migration[5.2] - def change - change_column_null(Document, :document_type_id, true) - end -end diff --git a/db/migrate/20191114123329_repopulate_document_id_in_metadata_revisions.rb b/db/migrate/20191114123329_repopulate_document_id_in_metadata_revisions.rb deleted file mode 100644 index cc5ac3389b..0000000000 --- a/db/migrate/20191114123329_repopulate_document_id_in_metadata_revisions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class RepopulateDocumentIdInMetadataRevisions < ActiveRecord::Migration[5.2] - def up - type_doc_ids_hash = Document.group(:document_type_id).pluck(:document_type_id, "ARRAY_AGG(id)").to_h - - type_doc_ids_hash.each do |type, ids| - MetadataRevision.joins("INNER JOIN revisions ON metadata_revisions.id = revisions.metadata_revision_id") - .where("revisions.document_id": ids).update_all(document_type_id: type) - end - end -end diff --git a/db/migrate/20191114135544_add_not_null_constraint_on_document_type_id.rb b/db/migrate/20191114135544_add_not_null_constraint_on_document_type_id.rb deleted file mode 100644 index 8e1510a7cf..0000000000 --- a/db/migrate/20191114135544_add_not_null_constraint_on_document_type_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotNullConstraintOnDocumentTypeId < ActiveRecord::Migration[5.2] - def change - change_column_null(:metadata_revisions, :document_type_id, false) - end -end diff --git a/db/migrate/20191115103058_remove_document_type_id_from_documents.rb b/db/migrate/20191115103058_remove_document_type_id_from_documents.rb deleted file mode 100644 index 9f26999ed4..0000000000 --- a/db/migrate/20191115103058_remove_document_type_id_from_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveDocumentTypeIdFromDocuments < ActiveRecord::Migration[5.2] - def change - remove_column :documents, :document_type_id, :string - end -end diff --git a/db/migrate/20191120110949_add_editor_political_to_metadata_revision.rb b/db/migrate/20191120110949_add_editor_political_to_metadata_revision.rb deleted file mode 100644 index 62d09e22f0..0000000000 --- a/db/migrate/20191120110949_add_editor_political_to_metadata_revision.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEditorPoliticalToMetadataRevision < ActiveRecord::Migration[5.2] - def change - add_column :metadata_revisions, :editor_political, :boolean - end -end diff --git a/db/migrate/20191120113230_add_system_political_to_edition.rb b/db/migrate/20191120113230_add_system_political_to_edition.rb deleted file mode 100644 index f65e06752e..0000000000 --- a/db/migrate/20191120113230_add_system_political_to_edition.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSystemPoliticalToEdition < ActiveRecord::Migration[5.2] - def change - add_column :editions, :system_political, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20191120161800_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20191120161800_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb deleted file mode 100644 index ff5d72c7ea..0000000000 --- a/db/migrate/20191120161800_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from active_storage (originally 20180723000244) -class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] - def up - return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) - - if table_exists?(:active_storage_blobs) - add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id - end - end -end diff --git a/db/migrate/20191120204541_add_government_id_to_edition.rb b/db/migrate/20191120204541_add_government_id_to_edition.rb deleted file mode 100644 index fd06238f0f..0000000000 --- a/db/migrate/20191120204541_add_government_id_to_edition.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddGovernmentIdToEdition < ActiveRecord::Migration[5.2] - def change - add_column :editions, :government_id, :uuid - end -end diff --git a/db/migrate/20191213094311_add_document_ref_to_whitehall_imports.rb b/db/migrate/20191213094311_add_document_ref_to_whitehall_imports.rb deleted file mode 100644 index e2d83b0b41..0000000000 --- a/db/migrate/20191213094311_add_document_ref_to_whitehall_imports.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddDocumentRefToWhitehallImports < ActiveRecord::Migration[6.0] - def change - add_reference :whitehall_imports, - :document, - foreign_key: { on_delete: :restrict }, - null: true, - index: false - end -end diff --git a/db/migrate/20191220080147_create_edition_editors.rb b/db/migrate/20191220080147_create_edition_editors.rb deleted file mode 100644 index 70b41727cf..0000000000 --- a/db/migrate/20191220080147_create_edition_editors.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateEditionEditors < ActiveRecord::Migration[6.0] - def change - create_table :edition_editors do |t| - t.references :edition, - foreign_key: { to_table: :editions, on_delete: :restrict }, - index: true, - null: false - - t.references :user, - foreign_key: { to_table: :users, on_delete: :restrict }, - index: true, - null: false - - t.index %i[edition_id user_id], unique: true - - t.datetime :created_at, null: false - end - end -end diff --git a/db/migrate/20191223085531_create_whitehall_migrations.rb b/db/migrate/20191223085531_create_whitehall_migrations.rb deleted file mode 100644 index 2eeff1fbf6..0000000000 --- a/db/migrate/20191223085531_create_whitehall_migrations.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateWhitehallMigrations < ActiveRecord::Migration[6.0] - def change - create_table :whitehall_migrations do |t| - t.text :organisation_slug, null: false - t.text :document_type, null: false - t.datetime :start_time - t.datetime :end_time - t.timestamps - end - - change_table :whitehall_imports, bulk: true do |t| - t.column :whitehall_migration_id, :bigint - end - - add_foreign_key :whitehall_imports, :whitehall_migrations - end -end diff --git a/db/migrate/20191223091535_populate_edition_editors.rb b/db/migrate/20191223091535_populate_edition_editors.rb deleted file mode 100644 index 73058173d4..0000000000 --- a/db/migrate/20191223091535_populate_edition_editors.rb +++ /dev/null @@ -1,23 +0,0 @@ -class PopulateEditionEditors < ActiveRecord::Migration[6.0] - class Edition < ApplicationRecord - has_and_belongs_to_many :edition_editors, - class_name: "User", - join_table: :edition_editors - end - - def up - revision_editors = Revision.joins(:editions_revisions) - .group(:edition_id) - .pluck(:edition_id, Arel.sql("ARRAY_AGG(DISTINCT created_by_id)")) - .to_h - - status_editors = Status.group(:edition_id) - .pluck(:edition_id, Arel.sql("ARRAY_AGG(DISTINCT created_by_id)")) - .to_h - - Edition.all.each do |edition| - editor_ids = (revision_editors[edition.id] + status_editors[edition.id]).uniq - edition.edition_editor_ids = editor_ids - end - end -end diff --git a/db/migrate/20191223092938_namespace_whitehall_import.rb b/db/migrate/20191223092938_namespace_whitehall_import.rb deleted file mode 100644 index 554e7ce8c8..0000000000 --- a/db/migrate/20191223092938_namespace_whitehall_import.rb +++ /dev/null @@ -1,5 +0,0 @@ -class NamespaceWhitehallImport < ActiveRecord::Migration[6.0] - def change - rename_table :whitehall_imports, :whitehall_migration_document_imports - end -end diff --git a/db/migrate/20191224093450_remove_not_null_from_document_import.rb b/db/migrate/20191224093450_remove_not_null_from_document_import.rb deleted file mode 100644 index 31a93de4ed..0000000000 --- a/db/migrate/20191224093450_remove_not_null_from_document_import.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveNotNullFromDocumentImport < ActiveRecord::Migration[6.0] - def change - change_column_null :whitehall_migration_document_imports, :payload, true - change_column_null :whitehall_migration_document_imports, :content_id, true - end -end diff --git a/db/migrate/20191224112030_rename_organisation_slug.rb b/db/migrate/20191224112030_rename_organisation_slug.rb deleted file mode 100644 index a8959425b0..0000000000 --- a/db/migrate/20191224112030_rename_organisation_slug.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameOrganisationSlug < ActiveRecord::Migration[6.0] - def change - rename_column :whitehall_migrations, :organisation_slug, :organisation_content_id - end -end diff --git a/db/migrate/20191230093500_create_whitehall_imported_assets.rb b/db/migrate/20191230093500_create_whitehall_imported_assets.rb deleted file mode 100644 index da5f672f8b..0000000000 --- a/db/migrate/20191230093500_create_whitehall_imported_assets.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateWhitehallImportedAssets < ActiveRecord::Migration[6.0] - def change - create_table :whitehall_migration_asset_imports do |t| - t.references :document_import, - foreign_key: { to_table: :whitehall_migration_document_imports, - on_delete: :restrict }, - index: { name: :index_whitehall_migration_asset_on_document }, - null: false - t.references :file_attachment_revision, - foreign_key: { to_table: :file_attachment_revisions, - on_delete: :restrict }, - index: false - t.references :image_revision, - foreign_key: { to_table: :image_revisions, - on_delete: :restrict }, - index: false - - t.string :original_asset_url, null: false - t.string :state, null: false, default: "pending" - t.string :variant - t.text :error_message - t.timestamps - end - end -end diff --git a/db/migrate/20200107151448_cascade_edition_editor_deletion.rb b/db/migrate/20200107151448_cascade_edition_editor_deletion.rb deleted file mode 100644 index 6ed8f668cd..0000000000 --- a/db/migrate/20200107151448_cascade_edition_editor_deletion.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CascadeEditionEditorDeletion < ActiveRecord::Migration[6.0] - def up - remove_foreign_key :edition_editors, :editions - add_foreign_key :edition_editors, :editions, on_delete: :cascade - end - - def down - remove_foreign_key :edition_editors, :editions - add_foreign_key :edition_editors, :editions, on_delete: :restrict - end -end diff --git a/db/migrate/20200109094012_add_integrity_check_problems_to_whitehall_document_migration.rb b/db/migrate/20200109094012_add_integrity_check_problems_to_whitehall_document_migration.rb deleted file mode 100644 index d3f961cb10..0000000000 --- a/db/migrate/20200109094012_add_integrity_check_problems_to_whitehall_document_migration.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddIntegrityCheckProblemsToWhitehallDocumentMigration < ActiveRecord::Migration[6.0] - def change - change_table :whitehall_migration_document_imports, bulk: true do |t| - t.string :integrity_check_problems, array: true, default: [], null: false - t.json :integrity_check_proposed_payload, default: "{}", null: false - end - end -end diff --git a/db/migrate/20200114095428_create_whitehall_migration_timeline_entries.rb b/db/migrate/20200114095428_create_whitehall_migration_timeline_entries.rb deleted file mode 100644 index 2c3d24991a..0000000000 --- a/db/migrate/20200114095428_create_whitehall_migration_timeline_entries.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateWhitehallMigrationTimelineEntries < ActiveRecord::Migration[6.0] - def change - create_table :timeline_entry_whitehall_imported_entries do |t| - t.string "entry_type", null: false - t.datetime "created_at" - end - end -end diff --git a/db/migrate/20200114140323_remove_migration_start_time.rb b/db/migrate/20200114140323_remove_migration_start_time.rb deleted file mode 100644 index 5ad0e8740a..0000000000 --- a/db/migrate/20200114140323_remove_migration_start_time.rb +++ /dev/null @@ -1,7 +0,0 @@ -class RemoveMigrationStartTime < ActiveRecord::Migration[6.0] - def change - remove_column :whitehall_migrations, - :start_time, - :datetime - end -end diff --git a/db/migrate/20200114163932_rename_whitehall_migrations_end_time.rb b/db/migrate/20200114163932_rename_whitehall_migrations_end_time.rb deleted file mode 100644 index 29ddbc17e1..0000000000 --- a/db/migrate/20200114163932_rename_whitehall_migrations_end_time.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameWhitehallMigrationsEndTime < ActiveRecord::Migration[6.0] - def change - rename_column :whitehall_migrations, :end_time, :finished_at - end -end diff --git a/db/migrate/20200122110833_add_body_to_timeline_entry_whitehall_imported_entries.rb b/db/migrate/20200122110833_add_body_to_timeline_entry_whitehall_imported_entries.rb deleted file mode 100644 index 4d2b06858d..0000000000 --- a/db/migrate/20200122110833_add_body_to_timeline_entry_whitehall_imported_entries.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBodyToTimelineEntryWhitehallImportedEntries < ActiveRecord::Migration[6.0] - def change - add_column :timeline_entry_whitehall_imported_entries, :body, :json, default: "{}", null: false - end -end diff --git a/db/migrate/20200124142150_rename_body_on_timeline_entry_whitehall_imported_entries_to_contents.rb b/db/migrate/20200124142150_rename_body_on_timeline_entry_whitehall_imported_entries_to_contents.rb deleted file mode 100644 index 716275c828..0000000000 --- a/db/migrate/20200124142150_rename_body_on_timeline_entry_whitehall_imported_entries_to_contents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameBodyOnTimelineEntryWhitehallImportedEntriesToContents < ActiveRecord::Migration[6.0] - def change - rename_column :timeline_entry_whitehall_imported_entries, :body, :contents - end -end diff --git a/db/migrate/20200130090021_add_whitehall_migration_subtypes.rb b/db/migrate/20200130090021_add_whitehall_migration_subtypes.rb deleted file mode 100644 index 0d8a2e472e..0000000000 --- a/db/migrate/20200130090021_add_whitehall_migration_subtypes.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWhitehallMigrationSubtypes < ActiveRecord::Migration[6.0] - def change - add_column :whitehall_migrations, :document_subtypes, :text, array: true - end -end diff --git a/db/migrate/20200206153428_remove_null_constraints_from_whitehall_migrations.rb b/db/migrate/20200206153428_remove_null_constraints_from_whitehall_migrations.rb deleted file mode 100644 index e7f636d331..0000000000 --- a/db/migrate/20200206153428_remove_null_constraints_from_whitehall_migrations.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveNullConstraintsFromWhitehallMigrations < ActiveRecord::Migration[6.0] - def change - change_column_null :whitehall_migrations, :document_type, true - change_column_null :whitehall_migrations, :organisation_content_id, true - end -end diff --git a/db/migrate/20200206162051_add_whitehall_migration_null_constraint_to_document_imports.rb b/db/migrate/20200206162051_add_whitehall_migration_null_constraint_to_document_imports.rb deleted file mode 100644 index 05df842ef4..0000000000 --- a/db/migrate/20200206162051_add_whitehall_migration_null_constraint_to_document_imports.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWhitehallMigrationNullConstraintToDocumentImports < ActiveRecord::Migration[6.0] - def change - change_column_null :whitehall_migration_document_imports, :whitehall_migration_id, false - end -end diff --git a/db/migrate/20200207224528_rename_removal_alternative_path_to_alternative_url.rb b/db/migrate/20200207224528_rename_removal_alternative_path_to_alternative_url.rb deleted file mode 100644 index e52881f8d8..0000000000 --- a/db/migrate/20200207224528_rename_removal_alternative_path_to_alternative_url.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameRemovalAlternativePathToAlternativeUrl < ActiveRecord::Migration[6.0] - def change - rename_column :removals, :alternative_path, :alternative_url - end -end diff --git a/db/migrate/20200217112039_add_change_history_to_metadata_revisions.rb b/db/migrate/20200217112039_add_change_history_to_metadata_revisions.rb deleted file mode 100644 index e7f40be952..0000000000 --- a/db/migrate/20200217112039_add_change_history_to_metadata_revisions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddChangeHistoryToMetadataRevisions < ActiveRecord::Migration[6.0] - def change - add_column :metadata_revisions, :change_history, :json, default: [], null: false - end -end diff --git a/db/migrate/20200218153946_add_published_at_to_editions.rb b/db/migrate/20200218153946_add_published_at_to_editions.rb deleted file mode 100644 index 29839004bc..0000000000 --- a/db/migrate/20200218153946_add_published_at_to_editions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPublishedAtToEditions < ActiveRecord::Migration[6.0] - def change - add_column :editions, :published_at, :datetime - end -end diff --git a/db/migrate/20200218161942_backfill_published_at_for_editions.rb b/db/migrate/20200218161942_backfill_published_at_for_editions.rb deleted file mode 100644 index 6573568f57..0000000000 --- a/db/migrate/20200218161942_backfill_published_at_for_editions.rb +++ /dev/null @@ -1,7 +0,0 @@ -class BackfillPublishedAtForEditions < ActiveRecord::Migration[6.0] - def up - Status.where(state: %w[published published_but_needs_2i]) - .order(:created_at) - .find_each { |s| s.edition.update!(published_at: s.created_at) unless s.edition.published_at } - end -end diff --git a/db/migrate/20200220111317_backfill_change_history_for_metadata_revisions.rb b/db/migrate/20200220111317_backfill_change_history_for_metadata_revisions.rb deleted file mode 100644 index f72a410ae6..0000000000 --- a/db/migrate/20200220111317_backfill_change_history_for_metadata_revisions.rb +++ /dev/null @@ -1,41 +0,0 @@ -class BackfillChangeHistoryForMetadataRevisions < ActiveRecord::Migration[6.0] - class MetadataRevision < ApplicationRecord - has_one :revision - end - - class Revision < ApplicationRecord - belongs_to :metadata_revision - has_and_belongs_to_many :editions - end - - class Edition < ApplicationRecord - belongs_to :revision - end - - disable_ddl_transaction! - - def up - change_history_ids = {} - MetadataRevision.find_each do |metadata_revision| - edition = metadata_revision.revision.editions.first - Edition.transaction do - edition.lock! - - change_history_editions = Edition.joins(revision: :metadata_revision) - .where("editions.number > 1 AND editions.number < ?", edition.number) - .where("metadata_revisions.update_type": "major") - .where(document_id: edition.document_id) - .order(published_at: :desc) - - change_history = change_history_editions.map do |e| - { id: change_history_ids[e.id] ||= SecureRandom.uuid, - note: e.revision.metadata_revision.change_note, - public_timestamp: e.published_at.rfc3339 } - end - - metadata_revision.change_history = change_history - metadata_revision.save! - end - end - end -end diff --git a/db/migrate/20200303115207_add_removed_at_to_removals.rb b/db/migrate/20200303115207_add_removed_at_to_removals.rb deleted file mode 100644 index 93a143b1c0..0000000000 --- a/db/migrate/20200303115207_add_removed_at_to_removals.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRemovedAtToRemovals < ActiveRecord::Migration[6.0] - def change - add_column :removals, :removed_at, :datetime - end -end diff --git a/db/migrate/20200303143426_backfill_removals_removed_at.rb b/db/migrate/20200303143426_backfill_removals_removed_at.rb deleted file mode 100644 index 8c3a596688..0000000000 --- a/db/migrate/20200303143426_backfill_removals_removed_at.rb +++ /dev/null @@ -1,9 +0,0 @@ -class BackfillRemovalsRemovedAt < ActiveRecord::Migration[6.0] - disable_ddl_transaction! - - class Removal < ApplicationRecord; end - - def up - Removal.find_each { |removal| removal.update!(removed_at: removal.created_at) } - end -end diff --git a/db/migrate/20200304083621_add_not_null_constraint_to_removed_at.rb b/db/migrate/20200304083621_add_not_null_constraint_to_removed_at.rb deleted file mode 100644 index 4f60439b94..0000000000 --- a/db/migrate/20200304083621_add_not_null_constraint_to_removed_at.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotNullConstraintToRemovedAt < ActiveRecord::Migration[6.0] - def change - change_column_null :removals, :removed_at, false - end -end diff --git a/db/migrate/20200312132425_add_file_attachment_metadata_for_publications.rb b/db/migrate/20200312132425_add_file_attachment_metadata_for_publications.rb deleted file mode 100644 index af031ff622..0000000000 --- a/db/migrate/20200312132425_add_file_attachment_metadata_for_publications.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddFileAttachmentMetadataForPublications < ActiveRecord::Migration[6.0] - def change - change_table :file_attachment_metadata_revisions, bulk: true do |t| - t.string :isbn - t.string :unique_reference - t.string :paper_number - t.string :parliamentary_session - t.string :official_document, default: "unofficial", null: false - end - end -end diff --git a/db/migrate/20200313130700_rename_official_document.rb b/db/migrate/20200313130700_rename_official_document.rb deleted file mode 100644 index 482a5d78ea..0000000000 --- a/db/migrate/20200313130700_rename_official_document.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameOfficialDocument < ActiveRecord::Migration[6.0] - def change - rename_column :file_attachment_metadata_revisions, :official_document, :official_document_type - end -end diff --git a/db/migrate/20200317152759_add_featured_attachment_ordering.rb b/db/migrate/20200317152759_add_featured_attachment_ordering.rb deleted file mode 100644 index 382e4af6c9..0000000000 --- a/db/migrate/20200317152759_add_featured_attachment_ordering.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddFeaturedAttachmentOrdering < ActiveRecord::Migration[6.0] - def change - add_column :metadata_revisions, :featured_attachment_ordering, :string, array: true, default: [], null: false - end -end diff --git a/db/migrate/20200403165044_allow_official_document_type_to_be_null.rb b/db/migrate/20200403165044_allow_official_document_type_to_be_null.rb deleted file mode 100644 index 52082b6ac4..0000000000 --- a/db/migrate/20200403165044_allow_official_document_type_to_be_null.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AllowOfficialDocumentTypeToBeNull < ActiveRecord::Migration[6.0] - def up - change_column :file_attachment_metadata_revisions, :official_document_type, :string, null: true, default: nil - end - - def down - change_column :file_attachment_metadata_revisions, :official_document_type, :string, null: false, default: "unofficial" - end -end diff --git a/db/migrate/20200411150039_remove_superfluous_initial_change_notes.rb b/db/migrate/20200411150039_remove_superfluous_initial_change_notes.rb deleted file mode 100644 index 5efec20980..0000000000 --- a/db/migrate/20200411150039_remove_superfluous_initial_change_notes.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveSuperfluousInitialChangeNotes < ActiveRecord::Migration[6.0] - def up - MetadataRevision.where(change_note: "First published.") - .update_all(change_note: nil) - end -end diff --git a/db/migrate/20200701093902_add_auth_bypass_id_to_editions.rb b/db/migrate/20200701093902_add_auth_bypass_id_to_editions.rb deleted file mode 100644 index 2f11f97315..0000000000 --- a/db/migrate/20200701093902_add_auth_bypass_id_to_editions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAuthBypassIdToEditions < ActiveRecord::Migration[6.0] - def change - add_column :editions, :auth_bypass_id, :uuid - end -end diff --git a/db/migrate/20200701100346_backfill_auth_bypass_id.rb b/db/migrate/20200701100346_backfill_auth_bypass_id.rb deleted file mode 100644 index c58b8da223..0000000000 --- a/db/migrate/20200701100346_backfill_auth_bypass_id.rb +++ /dev/null @@ -1,25 +0,0 @@ -class BackfillAuthBypassId < ActiveRecord::Migration[6.0] - disable_ddl_transaction! - - class Edition < ApplicationRecord - belongs_to :document - end - - def up - to_update = Edition.includes(:document).where(auth_bypass_id: nil) - to_update.find_each do |edition| - auth_bypass_id = generate_uuid_for_string(edition.document.content_id) - edition.update!(auth_bypass_id:) - end - end - - # This method has been copied from lib/preview_auth_bypass for perpetuity - # in a migration, it provides a transformation algorithm used to predictably - # convert a string to a UUID to provide obfuscation. - def generate_uuid_for_string(string) - ary = Digest::SHA256.hexdigest(string).unpack("NnnnnN") - ary[2] = (ary[2] & 0x0fff) | 0x4000 - ary[3] = (ary[3] & 0x3fff) | 0x8000 - sprintf "%08x-%04x-%04x-%04x-%04x%08x", *ary - end -end diff --git a/db/migrate/20200701131534_auth_bypass_id_not_null.rb b/db/migrate/20200701131534_auth_bypass_id_not_null.rb deleted file mode 100644 index b489547928..0000000000 --- a/db/migrate/20200701131534_auth_bypass_id_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AuthBypassIdNotNull < ActiveRecord::Migration[6.0] - def change - change_column_null :editions, :auth_bypass_id, false - end -end diff --git a/db/migrate/20210311092144_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20210311092144_add_service_name_to_active_storage_blobs.active_storage.rb deleted file mode 100644 index 95a21bbbea..0000000000 --- a/db/migrate/20210311092144_add_service_name_to_active_storage_blobs.active_storage.rb +++ /dev/null @@ -1,18 +0,0 @@ -# This migration comes from active_storage (originally 20190112182829) -class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] - def up - unless column_exists?(:active_storage_blobs, :service_name) - add_column :active_storage_blobs, :service_name, :string - - if (configured_service = ActiveStorage::Blob.service.name) - ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) - end - - change_column :active_storage_blobs, :service_name, :string, null: false - end - end - - def down - remove_column :active_storage_blobs, :service_name - end -end diff --git a/db/migrate/20210311092145_create_active_storage_variant_records.active_storage.rb b/db/migrate/20210311092145_create_active_storage_variant_records.active_storage.rb deleted file mode 100644 index fb6e2b0175..0000000000 --- a/db/migrate/20210311092145_create_active_storage_variant_records.active_storage.rb +++ /dev/null @@ -1,12 +0,0 @@ -# This migration comes from active_storage (originally 20191206030411) -class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] - def change - create_table :active_storage_variant_records do |t| - t.belongs_to :blob, null: false, index: false - t.string :variation_digest, null: false - - t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true - t.foreign_key :active_storage_blobs, column: :blob_id - end - end -end diff --git a/db/migrate/20220916182836_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20220916182836_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb deleted file mode 100644 index 93c8b85ade..0000000000 --- a/db/migrate/20220916182836_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from active_storage (originally 20211119233751) -class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] - def change - return unless table_exists?(:active_storage_blobs) - - change_column_null(:active_storage_blobs, :checksum, true) - end -end