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 Jul 13, 2019
1 parent e7acee5 commit f804290
Show file tree
Hide file tree
Showing 26 changed files with 267 additions and 161 deletions.
30 changes: 15 additions & 15 deletions app/models/user_group_has_checkout_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ def self.update_current_checkout_count
#
# Table name: user_group_has_checkout_types
#
# id :integer not null, primary key
# user_group_id :integer not null
# checkout_type_id :integer not null
# checkout_limit :integer default(0), not null
# checkout_period :integer default(0), not null
# checkout_renewal_limit :integer default(0), not null
# reservation_limit :integer default(0), not null
# reservation_expired_period :integer default(7), not null
# set_due_date_before_closing_day :boolean default(FALSE), not null
# fixed_due_date :datetime
# note :text
# position :integer
# created_at :datetime
# updated_at :datetime
# current_checkout_count :integer
# id :integer not null, primary key
# user_group_id :integer not null
# checkout_type_id :integer not null
# checkout_limit :integer default(0), not null
# checkout_period :integer default(0), not null
# checkout_renewal_limit :integer default(0), not null
# reservation_limit :integer default(0), not null
# reservation_expired_period :integer default(7), not null
# set_due_date_after_closing_day :boolean default(FALSE), not null
# fixed_due_date :datetime
# note :text
# position :integer
# created_at :datetime
# updated_at :datetime
# current_checkout_count :integer
#
8 changes: 4 additions & 4 deletions bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
ENGINE_PATH = File.expand_path('../lib/enju_circulation/engine', __dir__)
APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/enju_circulation/engine', __FILE__)
APP_PATH = File.expand_path('../../spec/dummy/config/application', __FILE__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
Expand Down
2 changes: 1 addition & 1 deletion enju_circulation.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec-activemodel-mocks"
s.add_development_dependency "rspec-rails", "~> 3.8"
s.add_development_dependency "simplecov"
s.add_development_dependency "sunspot_solr", "~> 2.4"
s.add_development_dependency "sunspot_solr", "~> 2.5"
s.add_development_dependency "selenium-webdriver"
s.add_development_dependency "puma"
s.add_development_dependency "annotate"
Expand Down
6 changes: 2 additions & 4 deletions spec/dummy/db/migrate/113_create_events.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateEvents < ActiveRecord::Migration[4.2]
def self.up
create_table :events do |t|
t.integer :library_id, null: false
t.integer :event_category_id, null: false
t.references :library, index: true, null: false
t.references :event_category, index: true, null: false
t.string :name
t.text :note
t.datetime :start_at
Expand All @@ -13,8 +13,6 @@ def self.up

t.timestamps
end
add_index :events, :library_id
add_index :events, :event_category_id
end

def self.down
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class CreateEventImportFiles < ActiveRecord::Migration[4.2]
def self.up
create_table :event_import_files do |t|
t.integer :parent_id
t.references :parent, index: true
t.string :content_type
t.integer :size
t.integer :user_id
t.references :user, index: true
t.text :note
t.datetime :imported_at
t.string :event_import_file_name
Expand All @@ -15,8 +15,6 @@ def self.up

t.timestamps
end
add_index :event_import_files, :parent_id
add_index :event_import_files, :user_id
end

def self.down
Expand Down
6 changes: 2 additions & 4 deletions spec/dummy/db/migrate/20090519203307_create_participates.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
class CreateParticipates < ActiveRecord::Migration[4.2]
def self.up
create_table :participates do |t|
t.integer :agent_id, null: false
t.integer :event_id, null: false
t.references :agent, index: true, null: false
t.references :event, index: true, null: false
t.integer :position

t.timestamps
end
add_index :participates, :event_id
add_index :participates, :agent_id
end

def self.down
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateEventImportResults < ActiveRecord::Migration[4.2]
def self.up
create_table :event_import_results do |t|
t.integer :event_import_file_id
t.integer :event_id
t.references :event_import_file
t.references :event
t.text :body

t.timestamps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddDefaultLibraryIdToEventImportFile < ActiveRecord::Migration[4.2]
def change
add_column :event_import_files, :default_library_id, :integer
add_reference :event_import_files, :default_library
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateEventExportFiles < ActiveRecord::Migration[4.2]
def change
create_table :event_export_files do |t|
t.integer :user_id
t.references :user, index: true
t.attachment :event_export
t.datetime :executed_at

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddDefaultEventCategoryIdToEventImportFile < ActiveRecord::Migration[4.2]
def change
add_column :event_import_files, :default_event_category_id, :integer
add_reference :event_import_files, :default_event_category
end
end
14 changes: 14 additions & 0 deletions spec/dummy/db/migrate/20151128142913_create_places.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreatePlaces < ActiveRecord::Migration[4.2]
def change
create_table :places do |t|
t.string :term
t.text :city
t.references :country, index: true
t.float :latitude
t.float :longitude

t.timestamps null: false
end
add_index :places, :term
end
end
5 changes: 5 additions & 0 deletions spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPlaceIdToEvent < ActiveRecord::Migration[4.2]
def change
add_reference :events, :place, index: true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddMostRecentToEventImportFileTransitions < ActiveRecord::Migration[4.2]
def up
add_column :event_import_file_transitions, :most_recent, :boolean, null: true
end

def down
remove_column :event_import_file_transitions, :most_recent
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddMostRecentToEventExportFileTransitions < ActiveRecord::Migration[4.2]
def up
add_column :event_export_file_transitions, :most_recent, :boolean, null: true
end

def down
remove_column :event_export_file_transitions, :most_recent
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddConstraintsToMostRecentForEventImportFileTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!

def up
add_index :event_import_file_transitions, [:event_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_event_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
change_column_null :event_import_file_transitions, :most_recent, false
end

def down
remove_index :event_import_file_transitions, name: "index_event_import_file_transitions_parent_most_recent"
change_column_null :event_import_file_transitions, :most_recent, true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddConstraintsToMostRecentForEventExportFileTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!

def up
add_index :event_export_file_transitions, [:event_export_file_id, :most_recent], unique: true, where: "most_recent", name: "index_event_export_file_transitions_parent_most_recent" #, algorithm: :concurrently
change_column_null :event_export_file_transitions, :most_recent, false
end

def down
remove_index :event_export_file_transitions, name: "index_event_export_file_transitions_parent_most_recent"
change_column_null :event_export_file_transitions, :most_recent, true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddForeignKeyToEventsReferencingEventCategories < ActiveRecord::Migration[5.1]
def change
add_foreign_key :events, :event_categories
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddDisplayNameTranslationsToEvent < ActiveRecord::Migration[5.2]
def change
add_column :event_categories, :display_name_translations, :jsonb, default: {}, null: false
add_column :events, :display_name_translations, :jsonb, default: {}, null: false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class AddDisplayNameTranslationsToCarrierType < ActiveRecord::Migration[5.2]
def change
[
:agent_relationship_types,
:agent_types,
:carrier_types,
:content_types,
:create_types,
:form_of_works,
:frequencies,
:languages,
:licenses,
:manifestation_relationship_types,
:medium_of_performances,
:produce_types,
:realize_types
].each do |table|
add_column table, :display_name_translations, :jsonb, default: {}, null: false
end
end
end
Loading

0 comments on commit f804290

Please sign in to comment.