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 Mar 17, 2019
1 parent 89609d4 commit 30eae3a
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 75 deletions.
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/124_create_bookstores.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateBookstores < ActiveRecord::Migration[5.2]
def change
create_table :bookstores do |t|
create_table :bookstores, id: :uuid do |t|
t.text :name, null: false
t.string :zip_code
t.text :address
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/133_create_agent_merges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class CreateAgentMerges < ActiveRecord::Migration[5.2]
def change
create_table :agent_merges do |t|
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :agent_merge_list, null: false
t.references :agent_merge_list, null: false, type: :uuid

t.timestamps
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/134_create_agent_merge_lists.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateAgentMergeLists < ActiveRecord::Migration[5.2]
def change
create_table :agent_merge_lists do |t|
create_table :agent_merge_lists, id: :uuid do |t|
t.string :title

t.timestamps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateSubscriptions < ActiveRecord::Migration[5.2]
def change
create_table :subscriptions do |t|
create_table :subscriptions, id: :uuid do |t|
t.text :title, null: false
t.text :note
t.references :user, foreign_key: true
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/20081006093246_create_subscribes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateSubscribes < ActiveRecord::Migration[5.2]
def change
create_table :subscribes do |t|
t.references :subscription, foreign_key: true, null: false
t.references :subscription, foreign_key: true, null: false, type: :uuid
t.references :work, null: false, type: :uuid
t.datetime :start_at, null: false
t.datetime :end_at, null: false
Expand Down
17 changes: 0 additions & 17 deletions spec/dummy/db/migrate/20090831220301_create_lending_policies.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateSeriesStatements < ActiveRecord::Migration[5.2]
def change
create_table :series_statements do |t|
t.text :title
create_table :series_statements, id: :uuid do |t|
t.text :title, null: false
t.text :numbering
t.text :title_subseries
t.text :numbering_subseries
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateImportRequests < ActiveRecord::Migration[5.2]
def change
create_table :import_requests do |t|
create_table :import_requests, id: :uuid do |t|
t.string :isbn, index: true, null: false
t.references :manifestation, foreign_key: true, type: :uuid
t.references :user, foreign_key: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddBookstoreIdToItem < ActiveRecord::Migration[5.2]
def change
add_reference :items, :bookstore, foreign_key: true
add_reference :items, :bookstore, foreign_key: true, type: :uuid
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateSeriesStatementMergeLists < ActiveRecord::Migration[5.2]
def change
create_table :series_statement_merge_lists do |t|
create_table :series_statement_merge_lists, id: :uuid do |t|
t.string :title

t.timestamps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateSeriesStatementMerges < ActiveRecord::Migration[5.2]
def change
create_table :series_statement_merges do |t|
t.references :series_statement, foreign_key: true, null: false
t.references :series_statement_merge_list, foreign_key: true, index: false, null: false
t.references :series_statement, foreign_key: true, null: false, type: :uuid
t.references :series_statement_merge_list, foreign_key: true, index: false, null: false, type: :uuid

t.timestamps
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/20120319173203_create_accepts.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateAccepts < ActiveRecord::Migration[5.2]
def change
create_table :accepts do |t|
create_table :accepts, id: :uuid do |t|
t.references :basket, foreign_key: true, type: :uuid
t.references :item, type: :uuid
t.references :librarian, foreign_key: {to_table: :users}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def change
t.string :to_state
t.jsonb :metadata, default: {}
t.integer :sort_key
t.references :import_request
t.references :import_request, type: :uuid
t.timestamps
end

Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/20150924115059_create_withdraws.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateWithdraws < ActiveRecord::Migration[5.2]
def change
create_table :withdraws do |t|
create_table :withdraws, id: :uuid do |t|
t.references :basket, foreign_key: true, type: :uuid
t.references :item, type: :uuid
t.references :librarian, foreign_key: {to_table: :users}
Expand Down
10 changes: 10 additions & 0 deletions spec/dummy/db/migrate/20190311154610_create_periodicals.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreatePeriodicals < ActiveRecord::Migration[5.2]
def change
create_table :periodicals, id: :uuid do |t|
t.text :original_title, null: false
t.references :frequency, foreign_key: true, null: false

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreatePeriodicalAndManifestations < ActiveRecord::Migration[5.2]
def change
create_table :periodical_and_manifestations do |t|
t.references :periodical, foreign_key: true, type: :uuid, null: false
t.references :manifestation, foreign_key: true, type: :uuid, null: false
t.boolean :periodical_master, default: false, null: false, index: {where: 'periodical_master IS true', unique: true}

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddFullNameTranslationsToCreate < ActiveRecord::Migration[5.2]
def change
add_column :creates, :full_name_translations, :jsonb, default: {}
add_column :realizes, :full_name_translations, :jsonb, default: {}
add_column :produces, :full_name_translations, :jsonb, default: {}
end
end
73 changes: 41 additions & 32 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_02_08_135957) do
ActiveRecord::Schema.define(version: 2019_03_14_151124) do

# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"

create_table "accepts", force: :cascade do |t|
create_table "accepts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "basket_id"
t.uuid "item_id"
t.bigint "librarian_id"
Expand Down Expand Up @@ -84,15 +84,15 @@
t.index ["agent_import_file_id"], name: "index_agent_import_results_on_agent_import_file_id"
end

create_table "agent_merge_lists", force: :cascade do |t|
create_table "agent_merge_lists", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "agent_merges", force: :cascade do |t|
t.uuid "agent_id", null: false
t.bigint "agent_merge_list_id", null: false
t.uuid "agent_merge_list_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["agent_id"], name: "index_agent_merges_on_agent_id"
Expand Down Expand Up @@ -191,7 +191,7 @@
t.index ["user_id"], name: "index_baskets_on_user_id"
end

create_table "bookstores", force: :cascade do |t|
create_table "bookstores", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.text "name", null: false
t.string "zip_code"
t.text "address"
Expand Down Expand Up @@ -373,6 +373,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "create_type_id"
t.jsonb "full_name_translations", default: {}
t.index ["agent_id"], name: "index_creates_on_agent_id"
t.index ["work_id"], name: "index_creates_on_work_id"
end
Expand Down Expand Up @@ -486,7 +487,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "import_request_id"
t.uuid "import_request_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -495,7 +496,7 @@
t.index ["sort_key", "import_request_id"], name: "index_import_request_transitions_on_sort_key_and_request_id", unique: true
end

create_table "import_requests", force: :cascade do |t|
create_table "import_requests", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "isbn", null: false
t.uuid "manifestation_id"
t.bigint "user_id"
Expand Down Expand Up @@ -593,7 +594,7 @@
t.integer "lock_version", default: 0, null: false
t.integer "required_role_id", default: 1, null: false
t.datetime "acquired_at"
t.bigint "bookstore_id"
t.uuid "bookstore_id"
t.integer "budget_type_id"
t.bigint "circulation_status_id", default: 5, null: false
t.bigint "checkout_type_id", default: 1, null: false
Expand Down Expand Up @@ -625,20 +626,6 @@
t.index ["name"], name: "index_languages_on_name", unique: true
end

create_table "lending_policies", force: :cascade do |t|
t.uuid "item_id", null: false
t.uuid "user_group_id", null: false
t.integer "loan_period", default: 0, null: false
t.datetime "fixed_due_date"
t.integer "renewal", default: 0, null: false
t.integer "fine", default: 0, null: false
t.text "note"
t.integer "position"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["item_id", "user_group_id"], name: "index_lending_policies_on_item_id_and_user_group_id", unique: true
end

create_table "libraries", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "name", null: false
t.jsonb "display_name_translations", default: {}, null: false
Expand Down Expand Up @@ -927,6 +914,25 @@
t.index ["item_id"], name: "index_owns_on_item_id"
end

create_table "periodical_and_manifestations", force: :cascade do |t|
t.uuid "periodical_id", null: false
t.uuid "manifestation_id", null: false
t.boolean "periodical_master", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["manifestation_id"], name: "index_periodical_and_manifestations_on_manifestation_id"
t.index ["periodical_id"], name: "index_periodical_and_manifestations_on_periodical_id"
t.index ["periodical_master"], name: "index_periodical_and_manifestations_on_periodical_master", unique: true, where: "(periodical_master IS TRUE)"
end

create_table "periodicals", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.text "original_title", null: false
t.bigint "frequency_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["frequency_id"], name: "index_periodicals_on_frequency_id"
end

create_table "picture_files", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "picture_attachable_id", null: false
t.string "picture_attachable_type", null: false
Expand Down Expand Up @@ -962,6 +968,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "produce_type_id"
t.jsonb "full_name_translations", default: {}
t.index ["agent_id"], name: "index_produces_on_agent_id"
t.index ["manifestation_id"], name: "index_produces_on_manifestation_id"
end
Expand Down Expand Up @@ -1003,6 +1010,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "realize_type_id"
t.jsonb "full_name_translations", default: {}
t.index ["agent_id"], name: "index_realizes_on_agent_id"
t.index ["expression_id"], name: "index_realizes_on_expression_id"
end
Expand Down Expand Up @@ -1167,23 +1175,23 @@
t.datetime "updated_at", null: false
end

create_table "series_statement_merge_lists", force: :cascade do |t|
create_table "series_statement_merge_lists", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "series_statement_merges", force: :cascade do |t|
t.bigint "series_statement_id", null: false
t.bigint "series_statement_merge_list_id", null: false
t.uuid "series_statement_id", null: false
t.uuid "series_statement_merge_list_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["series_statement_id"], name: "index_series_statement_merges_on_series_statement_id"
t.index ["series_statement_merge_list_id"], name: "index_series_statement_merges_on_list_id"
end

create_table "series_statements", force: :cascade do |t|
t.text "original_title"
create_table "series_statements", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.text "original_title", null: false
t.text "numbering"
t.text "title_subseries"
t.text "numbering_subseries"
Expand Down Expand Up @@ -1220,7 +1228,7 @@
end

create_table "subscribes", force: :cascade do |t|
t.bigint "subscription_id", null: false
t.uuid "subscription_id", null: false
t.uuid "work_id", null: false
t.datetime "start_at", null: false
t.datetime "end_at", null: false
Expand All @@ -1230,7 +1238,7 @@
t.index ["work_id"], name: "index_subscribes_on_work_id"
end

create_table "subscriptions", force: :cascade do |t|
create_table "subscriptions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.text "title", null: false
t.text "note"
t.bigint "user_id"
Expand Down Expand Up @@ -1446,7 +1454,7 @@
t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
end

create_table "withdraws", force: :cascade do |t|
create_table "withdraws", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "basket_id"
t.uuid "item_id"
t.bigint "librarian_id"
Expand Down Expand Up @@ -1507,8 +1515,6 @@
add_foreign_key "items", "checkout_types"
add_foreign_key "items", "circulation_statuses"
add_foreign_key "items", "manifestations"
add_foreign_key "lending_policies", "items"
add_foreign_key "lending_policies", "user_groups"
add_foreign_key "libraries", "library_groups"
add_foreign_key "library_groups", "users"
add_foreign_key "manifestation_checkout_stats", "users"
Expand All @@ -1517,6 +1523,9 @@
add_foreign_key "manifestation_reserve_stats", "users"
add_foreign_key "manifestations", "carrier_types"
add_foreign_key "messages", "messages", column: "parent_id"
add_foreign_key "periodical_and_manifestations", "manifestations"
add_foreign_key "periodical_and_manifestations", "periodicals"
add_foreign_key "periodicals", "frequencies"
add_foreign_key "produces", "agents"
add_foreign_key "produces", "manifestations"
add_foreign_key "realizes", "agents"
Expand Down
Loading

0 comments on commit 30eae3a

Please sign in to comment.