-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from scientist-softserv/add-guard-clause-arou…
…nd-migrations 🧹 Add table_exists? guard clauses to migrations
- Loading branch information
Showing
3 changed files
with
23 additions
and
17 deletions.
There are no files selected for viewing
14 changes: 8 additions & 6 deletions
14
db/migrate/20181214181358_create_iiif_print_derivative_attachments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
class CreateIiifPrintDerivativeAttachments < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :iiif_print_derivative_attachments do |t| | ||
t.string :fileset_id | ||
t.string :path | ||
t.string :destination_name | ||
unless table_exists?(:iiif_print_derivative_attachments) | ||
create_table :iiif_print_derivative_attachments do |t| | ||
t.string :fileset_id | ||
t.string :path | ||
t.string :destination_name | ||
|
||
t.timestamps | ||
t.timestamps | ||
end | ||
add_index :iiif_print_derivative_attachments, :fileset_id | ||
end | ||
add_index :iiif_print_derivative_attachments, :fileset_id | ||
end | ||
end |
12 changes: 7 additions & 5 deletions
12
db/migrate/20190107165909_create_iiif_print_ingest_file_relations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
class CreateIiifPrintIngestFileRelations < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :iiif_print_ingest_file_relations do |t| | ||
t.string :file_path | ||
t.string :derivative_path | ||
unless table_exists?(:iiif_print_ingest_file_relations) | ||
create_table :iiif_print_ingest_file_relations do |t| | ||
t.string :file_path | ||
t.string :derivative_path | ||
|
||
t.timestamps | ||
t.timestamps | ||
end | ||
add_index :iiif_print_ingest_file_relations, :file_path | ||
end | ||
add_index :iiif_print_ingest_file_relations, :file_path | ||
end | ||
end |
14 changes: 8 additions & 6 deletions
14
db/migrate/20230109000000_create_iiif_print_pending_relationships.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
class CreateIiifPrintPendingRelationships < ActiveRecord::Migration[5.1] | ||
def change | ||
create_table :iiif_print_pending_relationships do |t| | ||
t.string :child_title, null: false | ||
t.string :parent_id, null: false | ||
t.string :child_order, null: false | ||
t.timestamps | ||
unless table_exists?(:iiif_print_pending_relationships) | ||
create_table :iiif_print_pending_relationships do |t| | ||
t.string :child_title, null: false | ||
t.string :parent_id, null: false | ||
t.string :child_order, null: false | ||
t.timestamps | ||
end | ||
add_index :iiif_print_pending_relationships, :parent_id | ||
end | ||
add_index :iiif_print_pending_relationships, :parent_id | ||
end | ||
end |