Skip to content

Commit

Permalink
update dummy migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Jan 19, 2019
1 parent 432da40 commit 75a1a04
Show file tree
Hide file tree
Showing 34 changed files with 95 additions and 363 deletions.
13 changes: 3 additions & 10 deletions spec/dummy/db/migrate/005_create_manifestations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ def change
t.text :title_alternative
t.text :title_transcription
t.string :classification_number
t.string :manifestation_identifier
t.datetime :date_of_publication
t.string :manifestation_identifier, index: {unique: true}
t.datetime :date_of_publication, index: true
t.datetime :copyright_date
t.timestamps
t.string :access_address
t.string :access_address, index: true
t.integer :language_id, default: 1, null: false
t.integer :carrier_type_id, default: 1, null: false
t.integer :start_page
Expand All @@ -27,16 +27,9 @@ def change
t.boolean :repository_content, default: false, null: false
t.integer :lock_version, default: 0, null: false
t.integer :required_role_id, default: 1, null: false
t.integer :required_score, default: 0, null: false
t.integer :frequency_id, default: 1, null: false
t.boolean :subscription_master, default: false, null: false
end
#add_index :manifestations, :carrier_type_id
#add_index :manifestations, :required_role_id
add_index :manifestations, :access_address
#add_index :manifestations, :frequency_id
add_index :manifestations, :manifestation_identifier
add_index :manifestations, :updated_at
add_index :manifestations, :date_of_publication
end
end
8 changes: 2 additions & 6 deletions spec/dummy/db/migrate/006_create_items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ class CreateItems < ActiveRecord::Migration[5.2]
def change
create_table :items do |t|
t.string :call_number
t.string :item_identifier
t.string :item_identifier, index: {unique: true}
t.timestamps
t.integer :shelf_id, default: 1, null: false
t.references :shelf
t.boolean :include_supplements, default: false, null: false
t.text :note
t.string :url
t.integer :price
t.integer :lock_version, default: 0, null: false
t.integer :required_role_id, default: 1, null: false
t.integer :required_score, default: 0, null: false
end
add_index :items, :shelf_id
add_index :items, :item_identifier
add_index :items, :required_role_id
end
end
6 changes: 2 additions & 4 deletions spec/dummy/db/migrate/125_create_donates.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
class CreateDonates < ActiveRecord::Migration[5.2]
def change
create_table :donates do |t|
t.integer :agent_id, null: false
t.integer :item_id, null: false
t.references :agent, foreign_key: true, null: false
t.references :item, foreign_key: true, null: false

t.timestamps
end
add_index :donates, :agent_id
add_index :donates, :item_id
end
end
11 changes: 3 additions & 8 deletions spec/dummy/db/migrate/133_create_agent_merges.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
class CreateAgentMerges < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :agent_merges do |t|
t.integer :agent_id, :agent_merge_list_id, null: false
t.references :agent, foreign_key: true, null: false
t.references :agent_merge_list, null: false

t.timestamps
end
add_index :agent_merges, :agent_id
add_index :agent_merges, :agent_merge_list_id
end

def self.down
drop_table :agent_merges
end
end
18 changes: 0 additions & 18 deletions spec/dummy/db/migrate/149_create_message_templates.rb

This file was deleted.

23 changes: 0 additions & 23 deletions spec/dummy/db/migrate/154_create_messages.rb

This file was deleted.

18 changes: 0 additions & 18 deletions spec/dummy/db/migrate/20080819181903_create_message_requests.rb

This file was deleted.

5 changes: 2 additions & 3 deletions spec/dummy/db/migrate/20081006093246_create_subscribes.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
class CreateSubscribes < ActiveRecord::Migration[5.2]
def change
create_table :subscribes do |t|
t.references :subscription, index: true, null: false
t.integer :work_id, null: false
t.references :subscription, foreign_key: true, null: false
t.references :work, foreign_key: {to_table: :manifestations}, null: false
t.datetime :start_at, null: false
t.datetime :end_at, null: false

t.timestamps
end
add_index :subscribes, :work_id
end
end
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/20081027150907_create_picture_files.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreatePictureFiles < ActiveRecord::Migration[5.2]
def change
create_table :picture_files do |t|
t.integer :picture_attachable_id
t.string :picture_attachable_type
t.references :picture_attachable, null: false
t.string :picture_attachable_type, null: false
t.string :content_type
t.text :title
t.string :thumbnail
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
class CreateManifestationRelationships < ActiveRecord::Migration[5.2]
def change
create_table :manifestation_relationships do |t|
t.integer :parent_id
t.integer :child_id
t.integer :manifestation_relationship_type_id
t.references :parent, foreign_key: {to_table: :manifestations}, null: false
t.references :child, foreign_key: {to_table: :manifestations}, null: false
t.references :manifestation_relationship_type, index: false

t.timestamps
end
add_index :manifestation_relationships, :parent_id
add_index :manifestation_relationships, :child_id
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
class CreateAgentRelationships < ActiveRecord::Migration[5.2]
def change
create_table :agent_relationships do |t|
t.integer :parent_id
t.integer :child_id
t.integer :agent_relationship_type_id
t.references :parent, foreign_key: {to_table: :agents}, null: false
t.references :child, foreign_key: {to_table: :agents}, null: false
t.references :agent_relationship_type, index: false

t.timestamps
end
add_index :agent_relationships, :parent_id
add_index :agent_relationships, :child_id
end
end
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
class CreateResourceImportResults < ActiveRecord::Migration[5.2]
def change
create_table :resource_import_results do |t|
t.integer :resource_import_file_id
t.integer :manifestation_id
t.integer :item_id
t.references :resource_import_file, foreign_key: true
t.references :manifestation
t.references :item
t.text :body

t.timestamps
end
add_index :resource_import_results, :resource_import_file_id
add_index :resource_import_results, :manifestation_id
add_index :resource_import_results, :item_id
end
end
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateAgentImportResults < ActiveRecord::Migration[5.2]
def change
create_table :agent_import_results do |t|
t.integer :agent_import_file_id
t.integer :agent_id
t.references :agent_import_file, foreign_key: true, null: false
t.references :agent
t.text :body

t.timestamps
Expand Down
11 changes: 0 additions & 11 deletions spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
class AddManifestaitonIdToSeriesStatement < ActiveRecord::Migration[5.2]
def self.up
add_column :series_statements, :manifestation_id, :integer
add_index :series_statements, :manifestation_id
end

def self.down
remove_column :series_statements, :manifestation_id
def change
add_reference :series_statements, :manifestation, foreign_key: true
end
end
6 changes: 0 additions & 6 deletions spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 2 additions & 4 deletions spec/dummy/db/migrate/20130506175834_create_identifiers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ class CreateIdentifiers < ActiveRecord::Migration[5.2]
def change
create_table :identifiers do |t|
t.string :body, null: false
t.integer :identifier_type_id, null: false
t.integer :manifestation_id
t.integer :identifier_type_id, null: false, index: true
t.references :manifestation, foreign_key: true, null: false
t.boolean :primary
t.integer :position

t.timestamps
end
add_index :identifiers, [:body, :identifier_type_id]
add_index :identifiers, :manifestation_id
end
end
18 changes: 0 additions & 18 deletions spec/dummy/db/migrate/20140518111006_create_message_transitions.rb

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ class CreateResourceImportFileTransitions < ActiveRecord::Migration[5.2]
def change
create_table :resource_import_file_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.jsonb :metadata, default: {}
t.integer :sort_key
t.integer :resource_import_file_id
t.references :resource_import_file, index: false
t.timestamps
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ class CreateImportRequestTransitions < ActiveRecord::Migration[5.2]
def change
create_table :import_request_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.jsonb :metadata, default: {}
t.integer :sort_key
t.integer :import_request_id
t.references :import_request
t.timestamps
end

add_index :import_request_transitions, :import_request_id
add_index :import_request_transitions, [:sort_key, :import_request_id], unique: true, name: "index_import_request_transitions_on_sort_key_and_request_id"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ class CreateAgentImportFileTransitions < ActiveRecord::Migration[5.2]
def change
create_table :agent_import_file_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.jsonb :metadata, default: {}
t.integer :sort_key
t.integer :agent_import_file_id
t.references :agent_import_file
t.timestamps
end

add_index :agent_import_file_transitions, :agent_import_file_id
add_index :agent_import_file_transitions, [:sort_key, :agent_import_file_id], unique: true, name: "index_agent_import_file_transitions_on_sort_key_and_file_id"
end
end
Loading

0 comments on commit 75a1a04

Please sign in to comment.