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 29, 2019
1 parent f3eea94 commit ed542ff
Show file tree
Hide file tree
Showing 73 changed files with 2,472 additions and 239 deletions.
2 changes: 1 addition & 1 deletion app/models/inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Inventory < ActiveRecord::Base
# Table name: inventories
#
# id :bigint(8) not null, primary key
# item_id :bigint(8)
# item_id :uuid
# inventory_file_id :bigint(8)
# note :text
# created_at :datetime not null
Expand Down
10 changes: 3 additions & 7 deletions db/migrate/20081117143455_create_inventories.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
class CreateInventories < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :inventories do |t|
t.references :item, index: true
t.references :inventory_file, index: true
t.references :item, foreign_ley: true, type: :uuid
t.references :inventory_file, foreign_key: true
t.text :note

t.timestamps
end
end

def self.down
drop_table :inventories
end
end
2 changes: 1 addition & 1 deletion spec/controllers/items_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def valid_attributes
get :index, params: { inventory_file_id: 1 }
expect(response).to be_successful
assigns(:inventory_file).should eq InventoryFile.find(1)
expect(assigns(:items)).to eq Item.inventory_items(assigns(:inventory_file), 'not_on_shelf').order('items.id').page(1)
expect(assigns(:items)).to eq Item.inventory_items(assigns(:inventory_file), 'not_on_shelf').order('items.created_at').page(1)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class User < ActiveRecord::Base
devise :database_authenticatable, #:registerable,
:recoverable, :rememberable, :trackable, # , :validatable
devise :database_authenticatable, # :registerable,
:recoverable, :rememberable, # :validatable
:lockable, lock_strategy: :none, unlock_strategy: :none

include EnjuSeed::EnjuUser
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/001_create_agents.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateAgents < ActiveRecord::Migration[5.2]
def change
create_table :agents do |t|
create_table :agents, id: :uuid do |t|
t.string :last_name
t.string :middle_name
t.string :first_name
Expand Down
21 changes: 10 additions & 11 deletions spec/dummy/db/migrate/002_devise_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class DeviseCreateUsers < ActiveRecord::Migration[4.2]
def change
create_table(:users) do |t|
Expand All @@ -13,11 +15,11 @@ def change
t.datetime :remember_created_at

## Trackable
t.integer :sign_in_count, default: 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
# t.integer :sign_in_count, default: 0
# t.datetime :current_sign_in_at
# t.datetime :last_sign_in_at
# t.string :current_sign_in_ip
# t.string :last_sign_in_ip

## Confirmable
# t.string :confirmation_token
Expand All @@ -26,20 +28,17 @@ def change
# t.string :unconfirmed_email # Only if using reconfirmable

## Lockable
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at

## Token authenticatable
# t.string :authentication_token

t.timestamps
end

add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/005_create_manifestations.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CreateManifestations < ActiveRecord::Migration[5.2]
def change
create_table :manifestations do |t|
create_table :manifestations, id: :uuid do |t|
t.text :original_title, null: false
t.text :title_alternative
t.text :title_transcription
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/006_create_items.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class CreateItems < ActiveRecord::Migration[5.2]
def change
create_table :items do |t|
create_table :items, id: :uuid do |t|
t.string :call_number
t.string :item_identifier, index: {unique: true}
t.timestamps
t.references :shelf
t.references :shelf, type: :uuid
t.boolean :include_supplements, default: false, null: false
t.text :note
t.string :url
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/012_create_owns.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateOwns < ActiveRecord::Migration[5.2]
def change
create_table :owns do |t|
t.references :agent, null: false
t.references :item, null: false
t.references :agent, null: false, type: :uuid
t.references :item, null: false, type: :uuid
t.integer :position
t.timestamps
end
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/015_create_creates.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateCreates < ActiveRecord::Migration[5.2]
def change
create_table :creates do |t|
t.references :agent, null: false
t.references :work, null: false
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :work, null: false, type: :uuid, foreign_key: {to_table: :manifestations}
t.integer :position
t.timestamps
end
Expand Down
8 changes: 2 additions & 6 deletions spec/dummy/db/migrate/032_create_checkins.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
class CreateCheckins < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :checkins do |t|
t.references :item, index: true, foreign_key: true, null: false
t.references :item, foreign_key: true, null: false, type: :uuid
t.references :librarian, index: true
t.references :basket, index: true
t.timestamps
end
end

def self.down
drop_table :checkins
end
end
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/033_create_checkouts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class CreateCheckouts < ActiveRecord::Migration[5.2]
def change
create_table :checkouts do |t|
t.references :user, foreign_key: true
t.references :item, foreign_key: true, null: false
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
Expand Down
6 changes: 3 additions & 3 deletions spec/dummy/db/migrate/035_create_reserves.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class CreateReserves < ActiveRecord::Migration[5.2]
def change
create_table :reserves do |t|
t.references :user, index: true, foreign_key: true, null: false
t.references :manifestation, index: true, null: false
t.references :item, index: true
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
t.references :request_status_type, null: false
t.datetime :checked_out_at
t.timestamps
Expand Down
3 changes: 1 addition & 2 deletions spec/dummy/db/migrate/041_create_roles.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
class CreateRoles < ActiveRecord::Migration[5.2]
def change
create_table "roles" do |t|
t.string :name, null: false
t.string :name, null: false, index: {unique: true}
t.jsonb :display_name, default: {}, null: false
t.text :note
t.integer :score, default: 0, null: false
t.integer :position
t.timestamps
end
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/047_create_produces.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateProduces < ActiveRecord::Migration[5.2]
def change
create_table :produces do |t|
t.references :agent, null: false
t.references :manifestation, null: false
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :manifestation, foreign_key: true, null: false, type: :uuid
t.integer :position
t.timestamps
end
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/069_create_shelves.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class CreateShelves < ActiveRecord::Migration[5.2]
def change
create_table :shelves do |t|
create_table :shelves, id: :uuid do |t|
t.string :name, null: false
t.jsonb :display_name, default: {}, null: false
t.text :note
t.references :library, index: true, null: false
t.references :library, foreign_key: true, null: false
t.integer :items_count, default: 0, null: false
t.integer :position
t.timestamps
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/073_create_carrier_types.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateCarrierTypes < ActiveRecord::Migration[5.2]
def change
create_table :carrier_types do |t|
t.string :name, null: false
t.string :name, null: false, index: {unique: true}
t.jsonb :display_name, default: {}, null: false
t.text :note
t.integer :position
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/077_create_user_groups.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateUserGroups < ActiveRecord::Migration[5.2]
def change
create_table :user_groups do |t|
t.string :name, not_null: true
create_table :user_groups, id: :uuid do |t|
t.string :name, index: {unique: true}, null: false
t.jsonb :display_name, default: {}, null: false
t.text :note
t.integer :position
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/120_create_baskets.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateBaskets < ActiveRecord::Migration[5.2]
def change
create_table :baskets do |t|
t.references :user, index: true
t.references :user, foreign_key: true
t.text :note
t.integer :lock_version, default: 0, null: false

Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/121_create_checked_items.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateCheckedItems < ActiveRecord::Migration[5.2]
def change
create_table :checked_items do |t|
t.references :item, foreign_key: true, null: false
t.references :item, foreign_key: true, null: false, type: :uuid
t.references :basket, foreign_key: true, null: false
t.references :librarian, index: true
t.datetime :due_date, null: false
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/125_create_donates.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateDonates < ActiveRecord::Migration[5.2]
def change
create_table :donates do |t|
t.references :agent, foreign_key: true, null: false
t.references :item, foreign_key: true, null: false
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :item, foreign_key: true, null: false, type: :uuid

t.timestamps
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/127_create_use_restrictions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateUseRestrictions < ActiveRecord::Migration[5.2]
def change
create_table :use_restrictions do |t|
t.string :name, null: false
t.string :name, null: false, index: {unique: true}
t.jsonb :display_name, default: {}, null: false
t.text :note
t.integer :position
Expand Down
10 changes: 3 additions & 7 deletions spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
class CreateItemHasUseRestrictions < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :item_has_use_restrictions do |t|
t.references :item, index: true, foreign_key: true, null: false
t.references :use_restriction, index: true, foreign_key: true, null: false
t.references :item, foreign_key: true, null: false, type: :uuid
t.references :use_restriction, foreign_key: true, null: false

t.timestamps
end
end

def self.down
drop_table :item_has_use_restrictions
end
end
2 changes: 1 addition & 1 deletion spec/dummy/db/migrate/132_create_circulation_statuses.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateCirculationStatuses < ActiveRecord::Migration[5.2]
def change
create_table :circulation_statuses do |t|
t.string :name, null: false
t.string :name, null: false, index: {unique: true}
t.jsonb :display_name, default: {}, null: false
t.text :note
t.integer :position
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
@@ -1,7 +1,7 @@
class CreateAgentMerges < ActiveRecord::Migration[5.2]
def change
create_table :agent_merges do |t|
t.references :agent, foreign_key: true, null: false
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :agent_merge_list, null: false

t.timestamps
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/154_create_messages.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class CreateMessages < ActiveRecord::Migration[5.2]
def change
create_table :messages, force: true do |t|
create_table :messages, id: :uuid do |t|
t.datetime :read_at
t.references :sender, index: true
t.references :receiver, index: true
t.string :subject, null: false
t.text :body
t.references :message_request, index: true
t.references :parent, index: true
t.references :parent, foreign_key: {to_table: :messages}, type: :uuid

t.timestamps
end
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/20080830154109_create_realizes.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateRealizes < ActiveRecord::Migration[5.2]
def change
create_table :realizes do |t|
t.references :agent, null: false
t.references :expression, null: false
t.references :agent, foreign_key: true, null: false, type: :uuid
t.references :expression, null: false, type: :uuid, foreign_key: {to_table: :manifestations}
t.integer :position

t.timestamps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
create_table :subscriptions do |t|
t.text :title, null: false
t.text :note
t.references :user, index: true
t.references :user, foreign_key: true
t.references :order_list, index: true
t.integer :subscribes_count, default: 0, null: false

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
Expand Up @@ -2,7 +2,7 @@ class CreateSubscribes < ActiveRecord::Migration[5.2]
def change
create_table :subscribes do |t|
t.references :subscription, foreign_key: true, null: false
t.references :work, foreign_key: {to_table: :manifestations}, null: false
t.references :work, null: false, type: :uuid
t.datetime :start_at, null: false
t.datetime :end_at, null: false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreatePictureFiles < ActiveRecord::Migration[5.2]
def change
create_table :picture_files do |t|
t.references :picture_attachable, null: false
t.references :picture_attachable, null: false, type: :uuid
t.string :picture_attachable_type, null: false
t.string :content_type
t.text :title
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateUserGroupHasCheckoutTypes < ActiveRecord::Migration[5.2]
def change
create_table :user_group_has_checkout_types do |t|
t.references :user_group, foreign_key: true, null: false
t.references :user_group, foreign_key: true, null: false, type: :uuid
t.references :checkout_type, foreign_key: true, null: false
t.integer :checkout_limit, default: 0, null: false
t.integer :checkout_period, default: 0, null: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
class CreateCheckoutStatHasManifestations < ActiveRecord::Migration[5.2]
def self.up
def change
create_table :checkout_stat_has_manifestations do |t|
t.references :manifestation_checkout_stat, index: false, null: false
t.references :manifestation, index: false, foreign_key: true, null: false
t.references :manifestation, index: false, foreign_key: true, null: false, type: :uuid
t.integer :checkouts_count

t.timestamps
end
add_index :checkout_stat_has_manifestations, :manifestation_checkout_stat_id, name: 'index_checkout_stat_has_manifestations_on_checkout_stat_id'
add_index :checkout_stat_has_manifestations, :manifestation_id, name: 'index_checkout_stat_has_manifestations_on_manifestation_id'
end

def self.down
drop_table :checkout_stat_has_manifestations
end
end
Loading

0 comments on commit ed542ff

Please sign in to comment.