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 7, 2018
1 parent ef29db7 commit 7d6bd95
Show file tree
Hide file tree
Showing 23 changed files with 104 additions and 68 deletions.
2 changes: 1 addition & 1 deletion enju_news.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["spec/**/*"] - Dir["spec/dummy/log/*"] - Dir["spec/dummy/solr/{data,pids,default,development,test}/*"] - Dir["spec/dummy/tmp/*"] - Dir["spec/dummy/db/*.sqlite3"]

s.add_dependency "enju_library", "~> 0.2.3"
s.add_dependency "enju_library", "~> 0.2.4"

s.add_development_dependency "enju_leaf", "~> 1.2.1"
s.add_development_dependency "sqlite3"
Expand Down
16 changes: 7 additions & 9 deletions spec/dummy/db/migrate/059_create_libraries.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class CreateLibraries < ActiveRecord::Migration
def change
create_table :libraries do |t|
t.string :name, :null => false
t.string :name, index: true, null: false
t.text :display_name
t.string :short_display_name, :null => false
t.string :short_display_name, null: false
t.string :zip_code
t.text :street
t.text :locality
Expand All @@ -12,17 +12,15 @@ def change
t.string :telephone_number_2
t.string :fax_number
t.text :note
t.integer :call_number_rows, :default => 1, :null => false
t.string :call_number_delimiter, :default => "|", :null => false
t.integer :library_group_id, :default => 1, :null => false
t.integer :users_count, :default => 0, :null => false
t.integer :call_number_rows, default: 1, null: false
t.string :call_number_delimiter, default: "|", null: false
t.references :library_group, index: true, null: false
t.integer :users_count, default: 0, null: false
t.integer :position
t.integer :country_id
t.references :country

t.timestamps
t.datetime :deleted_at
end
add_index :libraries, :library_group_id
add_index :libraries, :name, :unique => true
end
end
7 changes: 3 additions & 4 deletions spec/dummy/db/migrate/069_create_shelves.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
class CreateShelves < ActiveRecord::Migration
def change
create_table :shelves do |t|
t.string :name, :null => false
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :library_id, :default => 1, :null => false
t.integer :items_count, :default => 0, :null => false
t.references :library, index: true, null: false
t.integer :items_count, default: 0, null: false
t.integer :position
t.timestamps
t.datetime :deleted_at
end
add_index :shelves, :library_id
end
end
5 changes: 2 additions & 3 deletions spec/dummy/db/migrate/080_create_library_groups.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class CreateLibraryGroups < ActiveRecord::Migration
def change
create_table :library_groups do |t|
t.string :name, :null => false
t.string :name, null: false
t.text :display_name
t.string :short_name, :null => false
t.string :short_name, index: true, null: false
t.text :my_networks
t.text :login_banner
t.text :note
Expand All @@ -12,6 +12,5 @@ def change

t.timestamps
end
add_index :library_groups, :short_name
end
end
5 changes: 2 additions & 3 deletions spec/dummy/db/migrate/120_create_baskets.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
class CreateBaskets < ActiveRecord::Migration
def change
create_table :baskets do |t|
t.integer :user_id
t.references :user, index: true
t.text :note
t.integer :lock_version, :default => 0, :null => false
t.integer :lock_version, default: 0, null: false

t.timestamps
end
add_index :baskets, :user_id
end
end
11 changes: 4 additions & 7 deletions spec/dummy/db/migrate/20081006090811_create_subscriptions.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
class CreateSubscriptions < ActiveRecord::Migration
def change
create_table :subscriptions do |t|
t.text :title, :null => false
t.text :title, null: false
t.text :note
#t.integer :subscription_list_id, :integer
t.integer :user_id
t.integer :order_list_id
t.references :user, index: true
t.references :order_list, index: true
t.datetime :deleted_at
t.integer :subscribes_count, :default => 0, :null => false
t.integer :subscribes_count, default: 0, null: false

t.timestamps
end
add_index :subscriptions, :user_id
add_index :subscriptions, :order_list_id
end
end
9 changes: 4 additions & 5 deletions spec/dummy/db/migrate/20081006093246_create_subscribes.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
class CreateSubscribes < ActiveRecord::Migration
def change
create_table :subscribes do |t|
t.integer :subscription_id, :null => false
t.integer :work_id, :null => false
t.datetime :start_at, :null => false
t.datetime :end_at, :null => false
t.references :subscription, index: true, null: false
t.integer :work_id, null: false
t.datetime :start_at, null: false
t.datetime :end_at, null: false

t.timestamps
end
add_index :subscribes, :subscription_id
add_index :subscribes, :work_id
end
end
9 changes: 3 additions & 6 deletions spec/dummy/db/migrate/20120319173203_create_accepts.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
class CreateAccepts < ActiveRecord::Migration
def change
create_table :accepts do |t|
t.integer :basket_id
t.integer :item_id
t.integer :librarian_id
t.references :basket, index: true
t.references :item, index: true
t.references :librarian, index: true

t.timestamps
end

add_index :accepts, :basket_id
add_index :accepts, :item_id
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateUserImportFiles < ActiveRecord::Migration
def change
create_table :user_import_files do |t|
t.integer :user_id
t.references :user, index: true
t.text :note
t.datetime :executed_at
t.string :user_import_file_name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class CreateUserImportResults < ActiveRecord::Migration
def change
create_table :user_import_results do |t|
t.integer :user_import_file_id
t.integer :user_id
t.references :user_import_file, index: true
t.references :user, index: true
t.text :body

t.timestamps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ def change
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.integer :user_import_file_id
t.references :user_import_file, index: true
t.timestamps
end

add_index :user_import_file_transitions, :user_import_file_id
add_index :user_import_file_transitions, [:sort_key, :user_import_file_id], unique: true, name: "index_user_import_file_transitions_on_sort_key_and_file_id"
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateUserExportFiles < ActiveRecord::Migration
def change
create_table :user_export_files do |t|
t.integer :user_id
t.references :user, index: true
t.attachment :user_export
t.datetime :executed_at

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def change
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.integer :user_export_file_id
t.references :user_export_file, index: true
t.timestamps
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddDefaultLibraryIdToUserImportFile < ActiveRecord::Migration
def change
add_column :user_import_files, :default_library_id, :integer
add_reference :user_import_files, :default_library
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddDefaultUserGroupIdToUserImportFile < ActiveRecord::Migration
def change
add_column :user_import_files, :default_user_group_id, :integer
add_reference :user_import_files, :default_user_group
end
end
4 changes: 1 addition & 3 deletions spec/dummy/db/migrate/20140821151023_create_colors.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
class CreateColors < ActiveRecord::Migration
def change
create_table :colors do |t|
t.integer :library_group_id
t.references :library_group, index: true
t.string :property
t.string :code
t.integer :position

t.timestamps
end

add_index :colors, :library_group_id
end
end
8 changes: 3 additions & 5 deletions spec/dummy/db/migrate/20150924115059_create_withdraws.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
class CreateWithdraws < ActiveRecord::Migration
def change
create_table :withdraws do |t|
t.integer :basket_id
t.integer :item_id
t.integer :librarian_id
t.references :basket, index: true
t.references :item, index: true
t.references :librarian, index: true

t.timestamps null: false
end
add_index :withdraws, :basket_id
add_index :withdraws, :item_id
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# This migration comes from enju_library_engine (originally 20151213070943)
class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
def up
LibraryGroup.create_translation_table!({
login_banner: :text
}, {
migrate_data: true
})
if defined?(Globalize)
LibraryGroup.create_translation_table!({
login_banner: :text
}, {
migrate_data: true
})
end

if defined?(AwesomeHstoreTranslate)
add_column :library_groups, :login_banner, :hstore
end
end

def down
LibraryGroup.drop_translation_table! migrate_data: true
if defined?(Globalize)
LibraryGroup.drop_translation_table! migrate_data: true
end

if defined?(AwesomeHstoreTranslate)
remove_column :library_groups, :login_banner
end
end
end
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# This migration comes from enju_library_engine (originally 20151213072705)
class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
def up
LibraryGroup.add_translation_fields! footer_banner: :text
if defined?(Globalize)
LibraryGroup.add_translation_fields! footer_banner: :text
end

if defined?(AwesomeHstoreTranslate)
add_column :library_groups, :footer_banner, :hstore
end
end

def down
remove_column :library_group_translations, :footer_banner
if defined?(Globalize)
remove_column :library_group_translations, :footer_banner
end

if defined?(AwesomeHstoreTranslate)
remove_column :library_groups, :footer_banner
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCsvCharsetConversionToLibraryGroup < ActiveRecord::Migration
def change
add_column :library_groups, :csv_charset_conversion, :boolean, null: false, default: false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SetNotNullToManifestationIdOnItems < ActiveRecord::Migration
def change
change_column_null :items, :manifestation_id, false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddHeaderLogoMetaToLibraryGroup < ActiveRecord::Migration
def change
add_column :library_groups, :header_logo_meta, :text
end
end
Loading

0 comments on commit 7d6bd95

Please sign in to comment.