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 11, 2019
1 parent ff4ce92 commit 7494e7e
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 61 deletions.
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/032_create_checkins.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateCheckins < ActiveRecord::Migration[5.2]
def change
create_table :checkins do |t|
create_table :checkins, id: :uuid do |t|
t.references :librarian, index: true
t.references :basket, index: true, type: :uuid
t.timestamps
Expand Down
3 changes: 1 addition & 2 deletions spec/dummy/db/migrate/033_create_checkouts.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
class CreateCheckouts < ActiveRecord::Migration[5.2]
def change
create_table :checkouts do |t|
create_table :checkouts, id: :uuid do |t|
t.references :user, foreign_key: true
t.references :item, foreign_key: true, null: false, type: :uuid
t.references :checkin, foreign_key: true
t.references :librarian, foreign_key: {to_table: :users}
t.references :basket, index: true, type: :uuid
t.datetime :due_date
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/035_create_reserves.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateReserves < ActiveRecord::Migration[5.2]
def change
create_table :reserves do |t|
create_table :reserves, id: :uuid do |t|
t.references :user, foreign_key: true, null: false
t.references :manifestation, foreign_key: true, null: false, type: :uuid
t.references :item, foreign_key: true, type: :uuid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateCheckoutStatHasManifestations < ActiveRecord::Migration[5.2]
def change
create_table :checkout_stat_has_manifestations do |t|
t.references :manifestation_checkout_stat, index: false, null: false
t.references :manifestation_checkout_stat, index: false, null: false, type: :uuid
t.references :manifestation, index: false, foreign_key: true, null: false, type: :uuid
t.integer :checkouts_count

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateManifestationCheckoutStats < ActiveRecord::Migration[5.2]
def self.up
create_table :manifestation_checkout_stats do |t|
def change
create_table :manifestation_checkout_stats, id: :uuid do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note

t.timestamps
end
end

def self.down
drop_table :manifestation_checkout_stats
end
end
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateUserCheckoutStats < ActiveRecord::Migration[5.2]
def self.up
create_table :user_checkout_stats do |t|
def change
create_table :user_checkout_stats, id: :uuid do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note

t.timestamps
end
end

def self.down
drop_table :user_checkout_stats
end
end
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateCheckoutStatHasUsers < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :checkout_stat_has_users do |t|
t.references :user_checkout_stat, index: true, foreign_key: true, null: false
t.references :user_checkout_stat, foreign_key: true, null: false, type: :uuid
t.references :user, index: true, foreign_key: true, null: false
t.integer :checkouts_count, default: 0, null: false

t.timestamps
end
end

def self.down
drop_table :checkout_stat_has_users
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateManifestationReserveStats < ActiveRecord::Migration[5.2]
def change
create_table :manifestation_reserve_stats do |t|
create_table :manifestation_reserve_stats, id: :uuid do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateUserReserveStats < ActiveRecord::Migration[5.2]
def self.up
create_table :user_reserve_stats do |t|
def change
create_table :user_reserve_stats, id: :uuid do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note

t.timestamps
end
end

def self.down
drop_table :user_reserve_stats
end
end
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateReserveStatHasUsers < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :reserve_stat_has_users do |t|
t.references :user_reserve_stat, index: true, foreign_key: true, null: false
t.references :user_reserve_stat, foreign_key: true, null: false, type: :uuid
t.references :user, index: true, foreign_key: true, null: false
t.integer :reserves_count

t.timestamps
end
end

def self.down
drop_table :reserve_stat_has_users
end
end
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 :reserve
t.references :reserve, type: :uuid
t.timestamps
end

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 :user_checkout_stat
t.references :user_checkout_stat, type: :uuid
t.timestamps
end

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 :user_reserve_stat
t.references :user_reserve_stat, type: :uuid
t.timestamps
end

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 :manifestation_checkout_stat, index: false
t.references :manifestation_checkout_stat, index: false, type: :uuid
t.timestamps
end

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 :manifestation_reserve_stat, index: false
t.references :manifestation_reserve_stat, index: false, type: :uuid
t.timestamps
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddCheckoutIdToCheckin < ActiveRecord::Migration[5.2]
def change
add_reference :checkins, :checkout, foreign_key: true, null: false
add_reference :checkins, :checkout, foreign_key: true, null: false, type: :uuid
end
end
35 changes: 16 additions & 19 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,20 @@
t.index ["user_id"], name: "index_checked_items_on_user_id"
end

create_table "checkins", force: :cascade do |t|
create_table "checkins", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "librarian_id"
t.uuid "basket_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "lock_version", default: 0, null: false
t.bigint "checkout_id", null: false
t.uuid "checkout_id", null: false
t.index ["basket_id"], name: "index_checkins_on_basket_id"
t.index ["checkout_id"], name: "index_checkins_on_checkout_id"
t.index ["librarian_id"], name: "index_checkins_on_librarian_id"
end

create_table "checkout_stat_has_manifestations", force: :cascade do |t|
t.bigint "manifestation_checkout_stat_id", null: false
t.uuid "manifestation_checkout_stat_id", null: false
t.uuid "manifestation_id", null: false
t.integer "checkouts_count"
t.datetime "created_at", null: false
Expand All @@ -272,7 +272,7 @@
end

create_table "checkout_stat_has_users", force: :cascade do |t|
t.bigint "user_checkout_stat_id", null: false
t.uuid "user_checkout_stat_id", null: false
t.bigint "user_id", null: false
t.integer "checkouts_count", default: 0, null: false
t.datetime "created_at", null: false
Expand All @@ -291,10 +291,9 @@
t.index ["name"], name: "index_checkout_types_on_name", unique: true
end

create_table "checkouts", force: :cascade do |t|
create_table "checkouts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "user_id"
t.uuid "item_id", null: false
t.bigint "checkin_id"
t.bigint "librarian_id"
t.uuid "basket_id"
t.datetime "due_date"
Expand All @@ -305,7 +304,6 @@
t.uuid "shelf_id"
t.uuid "library_id"
t.index ["basket_id"], name: "index_checkouts_on_basket_id"
t.index ["checkin_id"], name: "index_checkouts_on_checkin_id"
t.index ["item_id", "basket_id"], name: "index_checkouts_on_item_id_and_basket_id", unique: true
t.index ["item_id"], name: "index_checkouts_on_item_id"
t.index ["librarian_id"], name: "index_checkouts_on_librarian_id"
Expand Down Expand Up @@ -778,7 +776,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "manifestation_checkout_stat_id"
t.uuid "manifestation_checkout_stat_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -787,7 +785,7 @@
t.index ["sort_key", "manifestation_checkout_stat_id"], name: "index_manifestation_checkout_stat_transitions_on_transition", unique: true
end

create_table "manifestation_checkout_stats", force: :cascade do |t|
create_table "manifestation_checkout_stats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "start_date"
t.datetime "end_date"
t.text "note"
Expand Down Expand Up @@ -823,7 +821,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "manifestation_reserve_stat_id"
t.uuid "manifestation_reserve_stat_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -832,7 +830,7 @@
t.index ["sort_key", "manifestation_reserve_stat_id"], name: "index_manifestation_reserve_stat_transitions_on_transition", unique: true
end

create_table "manifestation_reserve_stats", force: :cascade do |t|
create_table "manifestation_reserve_stats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "start_date"
t.datetime "end_date"
t.text "note"
Expand Down Expand Up @@ -1122,7 +1120,7 @@
end

create_table "reserve_stat_has_users", force: :cascade do |t|
t.bigint "user_reserve_stat_id", null: false
t.uuid "user_reserve_stat_id", null: false
t.bigint "user_id", null: false
t.integer "reserves_count"
t.datetime "created_at", null: false
Expand All @@ -1135,7 +1133,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "reserve_id"
t.uuid "reserve_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -1144,7 +1142,7 @@
t.index ["sort_key", "reserve_id"], name: "index_reserve_transitions_on_sort_key_and_reserve_id", unique: true
end

create_table "reserves", force: :cascade do |t|
create_table "reserves", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.bigint "user_id", null: false
t.uuid "manifestation_id", null: false
t.uuid "item_id"
Expand Down Expand Up @@ -1342,7 +1340,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "user_checkout_stat_id"
t.uuid "user_checkout_stat_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -1351,7 +1349,7 @@
t.index ["user_checkout_stat_id"], name: "index_user_checkout_stat_transitions_on_user_checkout_stat_id"
end

create_table "user_checkout_stats", force: :cascade do |t|
create_table "user_checkout_stats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "start_date"
t.datetime "end_date"
t.text "note"
Expand Down Expand Up @@ -1471,7 +1469,7 @@
t.string "to_state"
t.jsonb "metadata", default: {}
t.integer "sort_key"
t.bigint "user_reserve_stat_id"
t.uuid "user_reserve_stat_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "most_recent", null: false
Expand All @@ -1480,7 +1478,7 @@
t.index ["user_reserve_stat_id"], name: "index_user_reserve_stat_transitions_on_user_reserve_stat_id"
end

create_table "user_reserve_stats", force: :cascade do |t|
create_table "user_reserve_stats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "start_date"
t.datetime "end_date"
t.text "note"
Expand Down Expand Up @@ -1544,7 +1542,6 @@
add_foreign_key "checkout_stat_has_manifestations", "manifestations"
add_foreign_key "checkout_stat_has_users", "user_checkout_stats"
add_foreign_key "checkout_stat_has_users", "users"
add_foreign_key "checkouts", "checkins"
add_foreign_key "checkouts", "items"
add_foreign_key "checkouts", "libraries"
add_foreign_key "checkouts", "shelves"
Expand Down

0 comments on commit 7494e7e

Please sign in to comment.