repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb | db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb | class AddPubYearFacetRangeIntervalToLibraryGroup < ActiveRecord::Migration[4.2]
def change
add_column :library_groups, :pub_year_facet_range_interval, :integer, default: 10
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110222073537_add_url_to_library_group.rb | db/migrate/20110222073537_add_url_to_library_group.rb | class AddUrlToLibraryGroup < ActiveRecord::Migration[4.2]
def up
add_column :library_groups, :url, :string, default: 'http://localhost:3000/'
end
def down
remove_column :library_groups, :url
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20200425072349_create_item_custom_properties.rb | db/migrate/20200425072349_create_item_custom_properties.rb | class CreateItemCustomProperties < ActiveRecord::Migration[5.2]
def change
create_table :item_custom_properties do |t|
t.string :name, null: false, comment: 'ラベル名', index: {unique: true}
t.text :display_name, null: false, comment: '表示名'
t.text :note, comment: '備考'
t.integer :position, default: 1, null: false
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140709113905_create_user_export_file_transitions.rb | db/migrate/20140709113905_create_user_export_file_transitions.rb | class CreateUserExportFileTransitions < ActiveRecord::Migration[4.2]
def change
create_table :user_export_file_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.references :user_export_file, index: true
t.timestamps
end
add_index :user_export_file_transitions, :user_export_file_id, name: "index_user_export_file_transitions_on_file_id"
add_index :user_export_file_transitions, [:sort_key, :user_export_file_id], unique: true, name: "index_user_export_file_transitions_on_sort_key_and_file_id"
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb | db/migrate/20140528045518_create_user_checkout_stat_transitions.rb | class CreateUserCheckoutStatTransitions < ActiveRecord::Migration[4.2]
def change
create_table :user_checkout_stat_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.integer :user_checkout_stat_id
t.timestamps
end
add_index :user_checkout_stat_transitions, :user_checkout_stat_id
add_index :user_checkout_stat_transitions, [:sort_key, :user_checkout_stat_id], unique: true, name: "index_user_checkout_stat_transitions_on_sort_key_and_stat_id"
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/112_create_frequencies.rb | db/migrate/112_create_frequencies.rb | class CreateFrequencies < ActiveRecord::Migration[4.2]
def change
create_table :frequencies do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110916091020_add_volume_number_to_manifestation.rb | db/migrate/20110916091020_add_volume_number_to_manifestation.rb | class AddVolumeNumberToManifestation < ActiveRecord::Migration[4.2]
def up
add_column :manifestations, :volume_number, :integer
add_column :manifestations, :issue_number, :integer
add_column :manifestations, :serial_number, :integer
end
def down
remove_column :manifestations, :serial_number
remove_column :manifestations, :issue_number
remove_column :manifestations, :volume_number
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160319144230_create_issn_records.rb | db/migrate/20160319144230_create_issn_records.rb | class CreateIssnRecords < ActiveRecord::Migration[6.1]
def change
create_table :issn_records, comment: 'ISSN' do |t|
t.string :body, null: false, comment: 'ISSN'
t.timestamps
end
add_index :issn_records, :body, unique: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20100925043847_create_resource_import_results.rb | db/migrate/20100925043847_create_resource_import_results.rb | class CreateResourceImportResults < ActiveRecord::Migration[4.2]
def change
create_table :resource_import_results do |t|
t.integer :resource_import_file_id
t.integer :manifestation_id
t.integer :item_id
t.text :body
t.timestamps
end
add_index :resource_import_results, :resource_import_file_id
add_index :resource_import_results, :manifestation_id
add_index :resource_import_results, :item_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20170116134107_create_issn_record_and_manifestations.rb | db/migrate/20170116134107_create_issn_record_and_manifestations.rb | class CreateIssnRecordAndManifestations < ActiveRecord::Migration[6.1]
def change
create_table :issn_record_and_manifestations, comment: '書誌とISSNの関係' do |t|
t.references :issn_record, foreign_key: true, null: false
t.references :manifestation, foreign_key: true, null: false, index: false
t.timestamps
end
add_index :issn_record_and_manifestations, [:manifestation_id, :issn_record_id], unique: true, name: 'index_issn_record_and_manifestations_on_manifestation_id'
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180709023038_add_missing_taggable_index.acts_as_taggable_on_engine.rb | db/migrate/20180709023038_add_missing_taggable_index.acts_as_taggable_on_engine.rb | # This migration comes from acts_as_taggable_on_engine (originally 4)
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]; end
else
class AddMissingTaggableIndex < ActiveRecord::Migration; end
end
AddMissingTaggableIndex.class_eval do
def up
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
def down
remove_index :taggings, [:taggable_id, :taggable_type, :context]
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110620173525_add_bookstore_id_to_item.rb | db/migrate/20110620173525_add_bookstore_id_to_item.rb | class AddBookstoreIdToItem < ActiveRecord::Migration[4.2]
def up
add_column :items, :bookstore_id, :integer
add_index :items, :bookstore_id
end
def down
remove_index :items, :bookstore_id
remove_column :items, :bookstore_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb | db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb | class AddForeignKeyToLibraryGroupIdOnLibrary < ActiveRecord::Migration[4.2]
def up
add_foreign_key :libraries, :library_groups, null: false
end
def down
remove_foreign_key :libraries, :library_groups
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb | db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb | class CreateCarrierTypeHasCheckoutTypes < ActiveRecord::Migration[4.2]
def up
create_table :carrier_type_has_checkout_types do |t|
t.references :carrier_type, index: false, foreign_key: true, null: false
t.references :checkout_type, index: true, foreign_key: true, null: false
t.text :note
t.integer :position
t.timestamps
end
add_index :carrier_type_has_checkout_types, :carrier_type_id, name: 'index_carrier_type_has_checkout_types_on_m_form_id'
end
def down
drop_table :carrier_type_has_checkout_types
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb | db/migrate/20120424103932_add_librarian_id_to_checked_item.rb | class AddLibrarianIdToCheckedItem < ActiveRecord::Migration[4.2]
def change
add_reference :checked_items, :user, index: true, foreign_key: true, column_name: :librarian_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb | db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb | class AddFingerprintToResourceImportFile < ActiveRecord::Migration[4.2]
def change
add_column :resource_import_files, :resource_import_fingerprint, :string
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20190312033839_create_periodical_and_manifestations.rb | db/migrate/20190312033839_create_periodical_and_manifestations.rb | class CreatePeriodicalAndManifestations < ActiveRecord::Migration[6.1]
def change
create_table :periodical_and_manifestations do |t|
t.references :periodical, null: false, foreign_key: true
t.references :manifestation, null: false, foreign_key: true
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb | db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb | class AddDefaultEventCategoryIdToEventImportFile < ActiveRecord::Migration[4.2]
def change
add_reference :event_import_files, :default_event_category
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140821151023_create_colors.rb | db/migrate/20140821151023_create_colors.rb | class CreateColors < ActiveRecord::Migration[4.2]
def change
create_table :colors do |t|
t.references :library_group, index: true
t.string :property
t.string :code
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120406020752_add_url_to_subject.rb | db/migrate/20120406020752_add_url_to_subject.rb | class AddUrlToSubject < ActiveRecord::Migration[4.2]
def change
add_column :subjects, :url, :string
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb | db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb | class AddMostRecentToResourceImportFileTransitions < ActiveRecord::Migration[4.2]
def up
add_column :resource_import_file_transitions, :most_recent, :boolean, null: true
end
def down
remove_column :resource_import_file_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/125_create_donates.rb | db/migrate/125_create_donates.rb | class CreateDonates < ActiveRecord::Migration[4.2]
def change
create_table :donates do |t|
t.integer :agent_id, null: false
t.integer :item_id, null: false
t.timestamps
end
add_index :donates, :agent_id
add_index :donates, :item_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb | db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb | class RenameLoginBannerToOldLoginBanner < ActiveRecord::Migration[4.2]
def change
rename_column :library_groups, :login_banner, :old_login_banner
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/077_create_user_groups.rb | db/migrate/077_create_user_groups.rb | class CreateUserGroups < ActiveRecord::Migration[4.2]
def change
create_table :user_groups do |t|
t.string :name
t.text :display_name
t.text :note
t.integer :position
t.timestamps
t.datetime :deleted_at
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/131_create_request_types.rb | db/migrate/131_create_request_types.rb | class CreateRequestTypes < ActiveRecord::Migration[4.2]
def change
create_table :request_types do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb | db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb | class AddMonthOfPublicationToManifestation < ActiveRecord::Migration[4.2]
def change
add_column :manifestations, :month_of_publication, :integer
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20240816112305_apply_enju_leaf14_default_columns.rb | db/migrate/20240816112305_apply_enju_leaf14_default_columns.rb | class ApplyEnjuLeaf14DefaultColumns < ActiveRecord::Migration[6.1]
def up
change_column :carrier_types, :attachment_file_size, :bigint
change_column :event_export_files, :event_export_file_size, :bigint
change_column :resource_export_files, :resource_export_file_size, :bigint
change_column :user_export_files, :user_export_file_size, :bigint
change_column :library_group_translations, :created_at, :timestamp, precision: 6
change_column :library_group_translations, :updated_at, :timestamp, precision: 6
change_column :library_groups, :header_logo_file_size, :bigint
end
def down
change_column :carrier_types, :attachment_file_size, :integer
change_column :event_export_files, :event_export_file_size, :integer
change_column :resource_export_files, :resource_export_file_size, :integer
change_column :user_export_files, :user_export_file_size, :integer
change_column :library_group_translations, :created_at, :timestamp
change_column :library_group_translations, :updated_at, :timestamp
change_column :library_groups, :header_logo_file_size, :integer
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb | db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb | class AddConstraintsToMostRecentForUserImportFileTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :user_import_file_transitions, [:user_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_user_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
change_column_null :user_import_file_transitions, :most_recent, false
end
def down
remove_index :user_import_file_transitions, name: "index_user_import_file_transitions_parent_most_recent"
change_column_null :user_import_file_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/015_create_creates.rb | db/migrate/015_create_creates.rb | class CreateCreates < ActiveRecord::Migration[4.2]
def change
create_table :creates do |t|
t.references :agent, null: false
t.references :work, null: false
t.integer :position
t.timestamps
end
add_index :creates, :agent_id
add_index :creates, :work_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb | db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb | class AddDefaultLibraryIdToEventImportFile < ActiveRecord::Migration[4.2]
def change
add_reference :event_import_files, :default_library
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20130506175834_create_identifiers.rb | db/migrate/20130506175834_create_identifiers.rb | class CreateIdentifiers < ActiveRecord::Migration[4.2]
def change
create_table :identifiers do |t|
t.string :body, null: false
t.integer :identifier_type_id, null: false
t.integer :manifestation_id
t.boolean :primary
t.integer :position
t.timestamps
end
add_index :identifiers, [:body, :identifier_type_id]
add_index :identifiers, :manifestation_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb | db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb | class AddMostRecentToUserReserveStatTransitions < ActiveRecord::Migration[4.2]
def up
add_column :user_reserve_stat_transitions, :most_recent, :boolean, null: true
end
def down
remove_column :user_reserve_stat_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20100525124311_create_manifestation_relationships.rb | db/migrate/20100525124311_create_manifestation_relationships.rb | class CreateManifestationRelationships < ActiveRecord::Migration[4.2]
def change
create_table :manifestation_relationships do |t|
t.integer :parent_id
t.integer :child_id
t.integer :manifestation_relationship_type_id
t.timestamps
end
add_index :manifestation_relationships, :parent_id
add_index :manifestation_relationships, :child_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160813191733_add_family_name_first_to_library_group.rb | db/migrate/20160813191733_add_family_name_first_to_library_group.rb | class AddFamilyNameFirstToLibraryGroup < ActiveRecord::Migration[4.2]
def change
add_column :library_groups, :family_name_first, :boolean, default: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140524135607_create_bookmark_stat_transitions.rb | db/migrate/20140524135607_create_bookmark_stat_transitions.rb | class CreateBookmarkStatTransitions < ActiveRecord::Migration[4.2]
def up
create_table :bookmark_stat_transitions, if_not_exists: true do |t|
t.string :to_state
if ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.integer :bookmark_stat_id
t.timestamps
end
add_index :bookmark_stat_transitions, :bookmark_stat_id
add_index :bookmark_stat_transitions, [:sort_key, :bookmark_stat_id], unique: true, name: "index_bookmark_stat_transitions_on_sort_key_and_stat_id"
end
def down
drop_table :bookmark_stat_transitions
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb | db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb | class AddConstraintsToMostRecentForUserReserveStatTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :user_reserve_stat_transitions, [:user_reserve_stat_id, :most_recent], unique: true, where: "most_recent", name: "index_user_reserve_stat_transitions_parent_most_recent" # , algorithm: :concurrently
change_column_null :user_reserve_stat_transitions, :most_recent, false
end
def down
remove_index :user_reserve_stat_transitions, name: "index_user_reserve_stat_transitions_parent_most_recent"
change_column_null :user_reserve_stat_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20250726121509_remove_paperclip_attachment_columns.rb | db/migrate/20250726121509_remove_paperclip_attachment_columns.rb | class RemovePaperclipAttachmentColumns < ActiveRecord::Migration[7.1]
def change
remove_column :agent_import_files, :agent_import_content_type, :string, if_exists: true
remove_column :agent_import_files, :agent_import_file_name, :string, if_exists: true
remove_column :agent_import_files, :agent_import_file_size, :integer, if_exists: true
remove_column :agent_import_files, :agent_import_updated_at, :datetime, if_exists: true
remove_column :agent_import_files, :content_type, :string, if_exists: true
remove_column :agent_import_files, :size, :integer, if_exists: true
remove_column :carrier_types, :attachment_content_type, :string, if_exists: true
remove_column :carrier_types, :attachment_file_name, :string, if_exists: true
remove_column :carrier_types, :attachment_file_size, :integer, if_exists: true
remove_column :carrier_types, :attachment_updated_at, :datetime, if_exists: true
remove_column :event_export_files, :event_export_content_type, :string, if_exists: true
remove_column :event_export_files, :event_export_file_name, :string, if_exists: true
remove_column :event_export_files, :event_export_file_size, :integer, if_exists: true
remove_column :event_export_files, :event_export_updated_at, :datetime, if_exists: true
remove_column :event_import_files, :event_import_content_type, :string, if_exists: true
remove_column :event_import_files, :event_import_file_name, :string, if_exists: true
remove_column :event_import_files, :event_import_file_size, :integer, if_exists: true
remove_column :event_import_files, :event_import_updated_at, :datetime, if_exists: true
remove_column :event_import_files, :content_type, :string, if_exists: true
remove_column :event_import_files, :size, :integer, if_exists: true
remove_column :inventory_files, :filename, :string, if_exists: true
remove_column :inventory_files, :inventory_content_type, :string, if_exists: true
remove_column :inventory_files, :inventory_file_name, :string, if_exists: true
remove_column :inventory_files, :inventory_file_size, :integer, if_exists: true
remove_column :inventory_files, :inventory_updated_at, :datetime, if_exists: true
remove_column :inventory_files, :content_type, :string, if_exists: true
remove_column :inventory_files, :size, :integer, if_exists: true
remove_column :library_groups, :header_logo_content_type, :string, if_exists: true
remove_column :library_groups, :header_logo_file_size, :integer, if_exists: true
remove_column :library_groups, :header_logo_file_name, :string, if_exists: true
remove_column :library_groups, :header_logo_meta, :text, if_exists: true
remove_column :library_groups, :header_logo_updated_at, :datetime, if_exists: true
remove_column :manifestations, :attachment_content_type, :string, if_exists: true
remove_column :manifestations, :attachment_file_name, :string, if_exists: true
remove_column :manifestations, :attachment_file_size, :integer, if_exists: true
remove_column :manifestations, :attachment_meta, :text, if_exists: true
remove_column :manifestations, :attachment_updated_at, :datetime, if_exists: true
remove_column :picture_files, :picture_content_type, :string, if_exists: true
remove_column :picture_files, :picture_file_name, :string, if_exists: true
remove_column :picture_files, :picture_file_size, :integer, if_exists: true
remove_column :picture_files, :picture_height, :integer, if_exists: true
remove_column :picture_files, :picture_meta, :text, if_exists: true
remove_column :picture_files, :picture_updated_at, :datetime, if_exists: true
remove_column :resource_export_files, :resource_export_content_type, :string, if_exists: true
remove_column :resource_export_files, :resource_export_file_name, :string, if_exists: true
remove_column :resource_export_files, :resource_export_file_size, :integer, if_exists: true
remove_column :resource_export_files, :resource_export_updated_at, :datetime, if_exists: true
remove_column :resource_import_files, :resource_import_content_type, :string, if_exists: true
remove_column :resource_import_files, :resource_import_file_name, :string, if_exists: true
remove_column :resource_import_files, :resource_import_file_size, :integer, if_exists: true
remove_column :resource_import_files, :resource_import_updated_at, :datetime, if_exists: true
remove_column :resource_import_files, :content_type, :string, if_exists: true
remove_column :resource_import_files, :size, :integer, if_exists: true
remove_column :user_export_files, :user_export_content_type, :string, if_exists: true
remove_column :user_export_files, :user_export_file_name, :string, if_exists: true
remove_column :user_export_files, :user_export_file_size, :integer, if_exists: true
remove_column :user_export_files, :user_export_updated_at, :datetime, if_exists: true
remove_column :user_import_files, :user_import_content_type, :string, if_exists: true
remove_column :user_import_files, :user_import_file_name, :string, if_exists: true
remove_column :user_import_files, :user_import_file_size, :integer, if_exists: true
remove_column :user_import_files, :user_import_updated_at, :datetime, if_exists: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb | db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb | class CreateCheckoutStatHasManifestations < ActiveRecord::Migration[4.2]
def up
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.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 down
drop_table :checkout_stat_has_manifestations
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb | db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb | class AddConstraintsToMostRecentForResourceImportFileTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :resource_import_file_transitions, [:resource_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_resource_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
change_column_null :resource_import_file_transitions, :most_recent, false
end
def down
remove_index :resource_import_file_transitions, name: "index_resource_import_file_transitions_parent_most_recent"
change_column_null :resource_import_file_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb | db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb | class AddMostRecentToUserCheckoutStatTransitions < ActiveRecord::Migration[4.2]
def up
add_column :user_checkout_stat_transitions, :most_recent, :boolean, null: true
end
def down
remove_column :user_checkout_stat_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/142_create_classifications.rb | db/migrate/142_create_classifications.rb | class CreateClassifications < ActiveRecord::Migration[4.2]
def up
create_table :classifications do |t|
t.integer :parent_id
t.string :category, null: false
t.text :note
t.integer :classification_type_id, null: false
t.timestamps
end
add_index :classifications, :parent_id
add_index :classifications, :category
add_index :classifications, :classification_type_id
end
def down
drop_table :classifications
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb | db/migrate/20081212151820_create_bookmark_stat_has_manifestations.rb | class CreateBookmarkStatHasManifestations < ActiveRecord::Migration[4.2]
def up
create_table :bookmark_stat_has_manifestations, if_not_exists: true do |t|
t.integer :bookmark_stat_id, null: false
t.integer :manifestation_id, null: false
t.integer :bookmarks_count
t.timestamps
end
add_index :bookmark_stat_has_manifestations, :bookmark_stat_id
add_index :bookmark_stat_has_manifestations, :manifestation_id
end
def down
drop_table :bookmark_stat_has_manifestations
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb | db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb | class AddMostRecentToBookmarkStatTransitions < ActiveRecord::Migration[4.2]
def up
add_column :bookmark_stat_transitions, :most_recent, :boolean, null: true, if_not_exists: true
end
def down
remove_column :bookmark_stat_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120319173203_create_accepts.rb | db/migrate/20120319173203_create_accepts.rb | class CreateAccepts < ActiveRecord::Migration[4.2]
def change
create_table :accepts do |t|
t.references :basket, index: true
t.references :item, index: true
t.references :librarian, index: true
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140122054321_create_profiles.rb | db/migrate/20140122054321_create_profiles.rb | class CreateProfiles < ActiveRecord::Migration[4.2]
def change
create_table :profiles do |t|
t.references :user, index: true, foreign_key: true
t.references :user_group, index: true
t.references :library, index: true
t.string :locale
t.string :user_number
t.text :full_name
t.text :note
t.text :keyword_list
t.references :required_role, index: false
t.timestamps
end
add_index :profiles, :user_number, unique: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20150106001709_create_demands.rb | db/migrate/20150106001709_create_demands.rb | class CreateDemands < ActiveRecord::Migration[4.2]
def change
create_table :demands do |t|
t.references :user, index: true, foreign_key: true
t.references :item, index: true, foreign_key: true
t.references :message, index: true, foreign_key: true
t.timestamps null: false
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081220023628_create_user_reserve_stats.rb | db/migrate/20081220023628_create_user_reserve_stats.rb | class CreateUserReserveStats < ActiveRecord::Migration[4.2]
def up
create_table :user_reserve_stats do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note
t.timestamps
end
end
def down
drop_table :user_reserve_stats
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb | db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb | class AddValidPeriodForNewUserToUserGroup < ActiveRecord::Migration[4.2]
def up
add_column :user_groups, :valid_period_for_new_user, :integer, default: 0, null: false
add_column :user_groups, :expired_at, :timestamp
end
def down
remove_column :user_groups, :valid_period_for_new_user
remove_column :user_groups, :expired_at
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/124_create_bookstores.rb | db/migrate/124_create_bookstores.rb | class CreateBookstores < ActiveRecord::Migration[4.2]
def change
create_table :bookstores do |t|
t.text :name, null: false
t.string :zip_code
t.text :address
t.text :note
t.string :telephone_number
t.string :fax_number
t.string :url
t.integer :position
t.datetime :deleted_at
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb | db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb | class AddUserIdToUserCheckoutStat < ActiveRecord::Migration[4.2]
def change
add_reference :user_checkout_stats, :user, index: true, foreign_key: true
add_reference :user_reserve_stats, :user, index: true, foreign_key: true
add_reference :manifestation_checkout_stats, :user, index: true, foreign_key: true
add_reference :manifestation_reserve_stats, :user, index: true, foreign_key: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120511072422_add_agent_identifier_to_agent.rb | db/migrate/20120511072422_add_agent_identifier_to_agent.rb | class AddAgentIdentifierToAgent < ActiveRecord::Migration[4.2]
def change
add_column :agents, :agent_identifier, :string
add_index :agents, :agent_identifier
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20121113163717_add_ncid_to_manifestation.rb | db/migrate/20121113163717_add_ncid_to_manifestation.rb | class AddNcidToManifestation < ActiveRecord::Migration[4.2]
def change
add_column :manifestations, :ncid, :string
add_index :manifestations, :ncid
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20130416054135_add_circulation_status_id_to_item.rb | db/migrate/20130416054135_add_circulation_status_id_to_item.rb | class AddCirculationStatusIdToItem < ActiveRecord::Migration[4.2]
def change
add_column :items, :circulation_status_id, :integer, default: 5, null: false
add_column :items, :checkout_type_id, :integer, default: 1, null: false
add_index :items, :circulation_status_id
add_index :items, :checkout_type_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140811031145_add_expired_at_to_profile.rb | db/migrate/20140811031145_add_expired_at_to_profile.rb | class AddExpiredAtToProfile < ActiveRecord::Migration[4.2]
def change
add_column :profiles, :expired_at, :datetime
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb | db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb | 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
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140812152348_create_event_export_files.rb | db/migrate/20140812152348_create_event_export_files.rb | class CreateEventExportFiles < ActiveRecord::Migration[4.2]
def change
create_table :event_export_files do |t|
t.references :user, index: true
t.string :event_export_content_type
t.string :event_export_file_name
t.integer :event_export_file_size
t.datetime :executed_at
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb | db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb | class AddConstraintsToMostRecentForUserCheckoutStatTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :user_checkout_stat_transitions, [:user_checkout_stat_id, :most_recent], unique: true, where: "most_recent", name: "index_user_checkout_stat_transitions_parent_most_recent" # , algorithm: :concurrently
change_column_null :user_checkout_stat_transitions, :most_recent, false
end
def down
remove_index :user_checkout_stat_transitions, name: "index_user_checkout_stat_transitions_parent_most_recent"
change_column_null :user_checkout_stat_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20231028035847_add_unique_index_to_carrier_type_has_checkout_types_on_carrier_type_id_and_checkout_type_id.rb | db/migrate/20231028035847_add_unique_index_to_carrier_type_has_checkout_types_on_carrier_type_id_and_checkout_type_id.rb | class AddUniqueIndexToCarrierTypeHasCheckoutTypesOnCarrierTypeIdAndCheckoutTypeId < ActiveRecord::Migration[6.1]
def change
remove_index :carrier_type_has_checkout_types, :carrier_type_id
add_index :carrier_type_has_checkout_types, [:carrier_type_id, :checkout_type_id], unique: true, name: 'index_carrier_type_has_checkout_types_on_carrier_type_id'
remove_index :user_group_has_checkout_types, :user_group_id
add_index :user_group_has_checkout_types, [:user_group_id, :checkout_type_id], unique: true, name: 'index_user_group_has_checkout_types_on_user_group_id'
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20150925092505_add_label_to_classification.rb | db/migrate/20150925092505_add_label_to_classification.rb | class AddLabelToClassification < ActiveRecord::Migration[4.2]
def change
add_column :classifications, :label, :string
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb | db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb | class AddEditModeToAgentImportFile < ActiveRecord::Migration[4.2]
def change
add_column :agent_import_files, :edit_mode, :string
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb | db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb | class AddMostRecentToUserExportFileTransitions < ActiveRecord::Migration[4.2]
def up
add_column :user_export_file_transitions, :most_recent, :boolean, null: true
end
def down
remove_column :user_export_file_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20240824070315_convert_library_group_settings_to_json.rb | db/migrate/20240824070315_convert_library_group_settings_to_json.rb | class ConvertLibraryGroupSettingsToJson < ActiveRecord::Migration[7.1]
def up
change_column :library_groups, :settings, :jsonb, using: 'settings::text::jsonb'
change_column_default :library_groups, :settings, {}
change_column_null :library_groups, :settings, false
end
def down
change_column :library_groups, :settings, :text
change_column_default :library_groups, :settings, nil
change_column_null :library_groups, :settings, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/133_create_agent_merges.rb | db/migrate/133_create_agent_merges.rb | class CreateAgentMerges < ActiveRecord::Migration[4.2]
def up
create_table :agent_merges do |t|
t.integer :agent_id, :agent_merge_list_id, null: false
t.timestamps
end
add_index :agent_merges, :agent_id
add_index :agent_merges, :agent_merge_list_id
end
def down
drop_table :agent_merges
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb | db/migrate/20141003181336_add_full_name_transcription_to_profile.rb | class AddFullNameTranscriptionToProfile < ActiveRecord::Migration[4.2]
def change
add_column :profiles, :full_name_transcription, :text
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20221112160158_change_column_id_type_bigint.rb | db/migrate/20221112160158_change_column_id_type_bigint.rb | class ChangeColumnIdTypeBigint < ActiveRecord::Migration[6.1]
def change
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
change_column table, :id, :bigint
end
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
columns = ActiveRecord::Base.connection.columns(table).map(&:name)
change_column table, :user_id, :bigint if columns.include?('user_id')
change_column table, :librarian_id, :bigint if columns.include?('librarian_id')
end
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
next unless ActiveRecord::Base.connection.columns(table).map(&:name).include?('agent_id')
change_column table, :agent_id, :bigint
end
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
next unless ActiveRecord::Base.connection.columns(table).map(&:name).include?('manifestation_id')
change_column table, :manifestation_id, :bigint
end
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
next unless ActiveRecord::Base.connection.columns(table).map(&:name).include?('library_id')
change_column table, :library_id, :bigint
end
ActiveRecord::Base.connection.tables.each do |table|
next if ['schema_migrations', 'ar_internal_metadata'].include?(table)
next unless ActiveRecord::Base.connection.columns(table).map(&:name).include?('item_id')
change_column table, :item_id, :bigint
end
[
:accepts,
:checked_items,
:checkins,
:checkouts,
:withdraws
].each do |table|
change_column table, :basket_id, :bigint
end
change_column :checkouts, :shelf_id, :bigint
change_column :items, :shelf_id, :bigint
change_column :resource_import_files, :default_shelf_id, :bigint
[
:agents,
:items,
:manifestations,
:news_posts,
:profiles,
:subjects
].each do |table|
change_column table, :required_role_id, :bigint
end
change_column :user_has_roles, :role_id, :bigint
[
:colors,
:libraries,
:library_group_translations,
:news_feeds
].each do |table|
change_column table, :library_group_id, :bigint
end
[
:accepts,
:checked_items,
:checkins,
:checkouts,
:withdraws
].each do |table|
change_column table, :basket_id, :bigint
end
[
:agents,
:libraries,
:library_groups,
:places
].each do |table|
change_column table, :country_id, :bigint
end
[
:agent_import_files,
:agent_relationships,
:classifications,
:event_import_files,
:manifestation_relationships,
:resource_import_files,
:subjects
].each do |table|
change_column table, :parent_id, :bigint
end
[
:agent_relationships,
:manifestation_relationships
].each do |table|
change_column table, :child_id, :bigint
end
[
:creates,
:subscribes
].each do |table|
change_column table, :work_id, :bigint
end
[
:agents,
:manifestations
].each do |table|
change_column table, :language_id, :bigint
end
[
:agents,
:identities
].each do |table|
change_column table, :profile_id, :bigint
end
[
:profiles,
:user_group_has_checkout_types
].each do |table|
change_column table, :user_group_id, :bigint
end
[
:carrier_type_has_checkout_types,
:manifestations
].each do |table|
change_column table, :carrier_type_id, :bigint
end
[
:carrier_type_has_checkout_types,
:items,
:user_group_has_checkout_types
].each do |table|
change_column table, :checkout_type_id, :bigint
end
change_column :agent_import_file_transitions, :agent_import_file_id, :bigint
change_column :agent_import_results, :agent_import_file_id, :bigint
change_column :agent_merges, :agent_merge_list_id, :bigint
change_column :agent_relationships, :agent_relationship_type_id, :bigint
change_column :agents, :agent_type_id, :bigint
change_column :bookmark_stat_has_manifestations, :bookmark_stat_id, :bigint
change_column :bookmark_stat_transitions, :bookmark_stat_id, :bigint
change_column :checkout_stat_has_manifestations, :manifestation_checkout_stat_id, :bigint
change_column :checkout_stat_has_users, :user_checkout_stat_id, :bigint
change_column :checkouts, :checkin_id, :bigint
change_column :classifications, :classification_type_id, :bigint
change_column :creates, :create_type_id, :bigint
change_column :demands, :message_id, :bigint
change_column :event_export_file_transitions, :event_export_file_id, :bigint
change_column :event_import_file_transitions, :event_import_file_id, :bigint
change_column :event_import_files, :default_library_id, :bigint
change_column :event_import_files, :default_event_category_id, :bigint
change_column :event_import_results, :event_import_file_id, :bigint
change_column :event_import_results, :event_id, :bigint
change_column :events, :event_category_id, :bigint
change_column :events, :place_id, :bigint
change_column :identifiers, :identifier_type_id, :bigint
change_column :import_request_transitions, :import_request_id, :bigint
change_column :inventories, :inventory_file_id, :bigint
change_column :item_has_use_restrictions, :use_restriction_id, :bigint
change_column :items, :bookstore_id, :bigint
change_column :items, :budget_type_id, :bigint
change_column :items, :circulation_status_id, :bigint
change_column :manifestation_checkout_stat_transitions, :manifestation_checkout_stat_id, :bigint
change_column :manifestation_relationships, :manifestation_relationship_type_id, :bigint
change_column :manifestation_reserve_stat_transitions, :manifestation_reserve_stat_id, :bigint
change_column :manifestations, :frequency_id, :bigint
change_column :manifestations, :nii_type_id, :bigint
change_column :manifestations, :content_type_id, :bigint
change_column :participates, :event_id, :bigint
change_column :picture_files, :picture_attachable_id, :bigint
change_column :produces, :produce_type_id, :bigint
change_column :realizes, :expression_id, :bigint
change_column :realizes, :realize_type_id, :bigint
change_column :reserve_stat_has_manifestations, :manifestation_reserve_stat_id, :bigint
change_column :reserve_stat_has_users, :user_reserve_stat_id, :bigint
change_column :reserve_transitions, :reserve_id, :bigint
change_column :reserves, :request_status_type_id, :bigint
change_column :reserves, :pickup_location_id, :bigint
change_column :resource_export_file_transitions, :resource_export_file_id, :bigint
change_column :resource_import_file_transitions, :resource_import_file_id, :bigint
change_column :resource_import_results, :resource_import_file_id, :bigint
change_column :series_statement_merges, :series_statement_id, :bigint
change_column :series_statement_merges, :series_statement_merge_list_id, :bigint
change_column :series_statements, :root_manifestation_id, :bigint
change_column :subjects, :use_term_id, :bigint
change_column :subjects, :subject_heading_type_id, :bigint
change_column :subjects, :subject_type_id, :bigint
change_column :subscribes, :subscription_id, :bigint
change_column :subscriptions, :order_list_id, :bigint
change_column :taggings, :tag_id, :bigint
change_column :taggings, :taggable_id, :bigint
change_column :taggings, :tagger_id, :bigint
change_column :user_checkout_stat_transitions, :user_checkout_stat_id, :bigint
change_column :user_export_file_transitions, :user_export_file_id, :bigint
change_column :user_import_file_transitions, :user_import_file_id, :bigint
change_column :user_import_files, :default_library_id, :bigint
change_column :user_import_files, :default_user_group_id, :bigint
change_column :user_import_results, :user_import_file_id, :bigint
change_column :user_reserve_stat_transitions, :user_reserve_stat_id, :bigint
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20091012101112_add_dcndl_schema.rb | db/migrate/20091012101112_add_dcndl_schema.rb | class AddDcndlSchema < ActiveRecord::Migration[4.2]
def up
add_column :manifestations, :title_alternative_transcription, :text
add_column :agents, :full_name_alternative_transcription, :text
add_column :manifestations, :description, :text
add_column :manifestations, :abstract, :text
add_column :manifestations, :available_at, :timestamp
add_column :manifestations, :valid_until, :timestamp
add_column :manifestations, :date_submitted, :timestamp
add_column :manifestations, :date_accepted, :timestamp
add_column :manifestations, :date_captured, :timestamp
rename_column :manifestations, :copyright_date, :date_copyrighted
end
def down
remove_column :manifestations, :title_alternative_transcription
remove_column :agents, :full_name_alternative_transcription
remove_column :manifestations, :description
remove_column :manifestations, :abstract
remove_column :manifestations, :available_at
remove_column :manifestations, :valid_until
remove_column :manifestations, :date_submitted
remove_column :manifestations, :date_accepted
remove_column :manifestations, :date_captured
rename_column :manifestations, :date_copyrighted, :copyright_date
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb | db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb | class AddConstraintsToMostRecentForAgentImportFileTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :agent_import_file_transitions, [:agent_import_file_id, :most_recent], unique: true, where: "most_recent", name: "index_agent_import_file_transitions_parent_most_recent" #, algorithm: :concurrently
change_column_null :agent_import_file_transitions, :most_recent, false
end
def down
remove_index :agent_import_file_transitions, name: "index_agent_import_file_transitions_parent_most_recent"
change_column_null :agent_import_file_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20111124110355_create_produce_types.rb | db/migrate/20111124110355_create_produce_types.rb | class CreateProduceTypes < ActiveRecord::Migration[4.2]
def change
create_table :produce_types do |t|
t.string :name
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20090720091106_create_medium_of_performances.rb | db/migrate/20090720091106_create_medium_of_performances.rb | class CreateMediumOfPerformances < ActiveRecord::Migration[4.2]
def change
create_table :medium_of_performances do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20100814091104_add_position_to_agent_relationship.rb | db/migrate/20100814091104_add_position_to_agent_relationship.rb | class AddPositionToAgentRelationship < ActiveRecord::Migration[4.2]
def up
add_column :manifestation_relationships, :position, :integer
add_column :agent_relationships, :position, :integer
end
def down
remove_column :agent_relationships, :position
remove_column :manifestation_relationships, :position
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/069_create_shelves.rb | db/migrate/069_create_shelves.rb | class CreateShelves < ActiveRecord::Migration[4.2]
def change
create_table :shelves do |t|
t.string :name, null: false
t.text :display_name
t.text :note
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
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081028083208_create_resource_import_files.rb | db/migrate/20081028083208_create_resource_import_files.rb | class CreateResourceImportFiles < ActiveRecord::Migration[4.2]
def change
create_table :resource_import_files do |t|
t.integer :parent_id
t.string :content_type
t.integer :size
t.integer :user_id
t.text :note
t.datetime :executed_at
t.string :resource_import_file_name
t.string :resource_import_content_type
t.integer :resource_import_file_size
t.datetime :resource_import_updated_at
t.timestamps
end
add_index :resource_import_files, :parent_id
add_index :resource_import_files, :user_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20150924115059_create_withdraws.rb | db/migrate/20150924115059_create_withdraws.rb | class CreateWithdraws < ActiveRecord::Migration[4.2]
def change
create_table :withdraws do |t|
t.references :basket, index: true
t.references :item, index: true
t.references :librarian, index: true
t.timestamps null: false
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20220918091042_add_service_name_to_active_storage_blobs.active_storage.rb | db/migrate/20220918091042_add_service_name_to_active_storage_blobs.active_storage.rb | # This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
return unless table_exists?(:active_storage_blobs)
remove_column :active_storage_blobs, :service_name
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20221112064850_add_index_to_produces_on_manifestation_id_and_agent_id.rb | db/migrate/20221112064850_add_index_to_produces_on_manifestation_id_and_agent_id.rb | class AddIndexToProducesOnManifestationIdAndAgentId < ActiveRecord::Migration[6.1]
def change
remove_index :produces, :manifestation_id
add_index :produces, [:manifestation_id, :agent_id], unique: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20141014065831_add_shelf_id_to_checkout.rb | db/migrate/20141014065831_add_shelf_id_to_checkout.rb | class AddShelfIdToCheckout < ActiveRecord::Migration[4.2]
def change
add_reference :checkouts, :shelf, index: true, foreign_key: true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20100607044753_create_manifestation_relationship_types.rb | db/migrate/20100607044753_create_manifestation_relationship_types.rb | class CreateManifestationRelationshipTypes < ActiveRecord::Migration[4.2]
def change
create_table :manifestation_relationship_types do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20090706125521_add_attachments_inventory_to_inventory_file.rb | db/migrate/20090706125521_add_attachments_inventory_to_inventory_file.rb | class AddAttachmentsInventoryToInventoryFile < ActiveRecord::Migration[4.2]
def up
add_column :inventory_files, :inventory_file_name, :string, if_not_exists: true
add_column :inventory_files, :inventory_content_type, :string, if_not_exists: true
add_column :inventory_files, :inventory_file_size, :integer, if_not_exists: true
add_column :inventory_files, :inventory_updated_at, :datetime, if_not_exists: true
end
def down
remove_column :inventory_files, :inventory_file_name
remove_column :inventory_files, :inventory_content_type
remove_column :inventory_files, :inventory_file_size
remove_column :inventory_files, :inventory_updated_at
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180709023036_add_missing_unique_indices.acts_as_taggable_on_engine.rb | db/migrate/20180709023036_add_missing_unique_indices.acts_as_taggable_on_engine.rb | # This migration comes from acts_as_taggable_on_engine (originally 2)
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end
else
class AddMissingUniqueIndices < ActiveRecord::Migration; end
end
AddMissingUniqueIndices.class_eval do
def up
add_index :tags, :name, unique: true, if_not_exists: true
remove_index :taggings, :tag_id if index_exists?(:taggings, :tag_id)
remove_index :taggings, [:taggable_id, :taggable_type, :context]
add_index :taggings,
[:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
unique: true, name: 'taggings_idx',
if_not_exists: true
end
def down
remove_index :tags, :name
remove_index :taggings, name: 'taggings_idx'
add_index :taggings, :tag_id unless index_exists?(:taggings, :tag_id)
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20190311154610_create_periodicals.rb | db/migrate/20190311154610_create_periodicals.rb | class CreatePeriodicals < ActiveRecord::Migration[6.1]
def change
create_table :periodicals do |t|
t.text :original_title, null: false
t.references :manifestation, null: false, foreign_key: true
t.references :frequency, null: false, foreign_key: true
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081009062130_create_orders.rb | db/migrate/20081009062130_create_orders.rb | class CreateOrders < ActiveRecord::Migration[6.1]
def up
create_table :orders, if_not_exists: true do |t|
t.references :order_list, foreign_key: true, null: false
t.references :purchase_request, foreign_key: true, null: false
t.integer :position
t.timestamps
end
end
def down
drop_table :orders
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb | db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb | class AddConstraintsToMostRecentForManifestationCheckoutStatTransitions < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
add_index :manifestation_checkout_stat_transitions, [:manifestation_checkout_stat_id, :most_recent], unique: true, where: "most_recent", name: "index_manifestation_checkout_stat_transitions_parent_most_rece" # , algorithm: :concurrently
change_column_null :manifestation_checkout_stat_transitions, :most_recent, false
end
def down
remove_index :manifestation_checkout_stat_transitions, name: "index_manifestation_checkout_stat_transitions_parent_most_rece"
change_column_null :manifestation_checkout_stat_transitions, :most_recent, true
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/073_create_carrier_types.rb | db/migrate/073_create_carrier_types.rb | class CreateCarrierTypes < ActiveRecord::Migration[4.2]
def change
create_table :carrier_types do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20111124112131_add_create_type_to_create.rb | db/migrate/20111124112131_add_create_type_to_create.rb | class AddCreateTypeToCreate < ActiveRecord::Migration[4.2]
def change
add_column :creates, :create_type_id, :integer
add_column :realizes, :realize_type_id, :integer
add_column :produces, :produce_type_id, :integer
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb | db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb | class AddBirthDateAndDeathDateToAgent < ActiveRecord::Migration[4.2]
def up
add_column :agents, :birth_date, :string
add_column :agents, :death_date, :string
end
def down
remove_column :agents, :death_date
remove_column :agents, :birth_date
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140528155058_create_order_list_transitions.rb | db/migrate/20140528155058_create_order_list_transitions.rb | class CreateOrderListTransitions < ActiveRecord::Migration[6.1]
def up
create_table :order_list_transitions, if_not_exits: true do |t|
t.string :to_state
t.text :metadata, default: "{}"
t.integer :sort_key
t.integer :order_list_id
t.timestamps
end
add_index :order_list_transitions, :order_list_id
add_index :order_list_transitions, [:sort_key, :order_list_id], unique: true
end
def down
remove_table :order_list_transitions
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb | db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb | class AddCurrentCheckoutCountToUserGroupHasCheckoutType < ActiveRecord::Migration[4.2]
def up
add_column :user_group_has_checkout_types, :current_checkout_count, :integer
end
def down
remove_column :user_group_has_checkout_types, :current_checkout_count
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081212080038_create_manifestation_checkout_stats.rb | db/migrate/20081212080038_create_manifestation_checkout_stats.rb | class CreateManifestationCheckoutStats < ActiveRecord::Migration[4.2]
def up
create_table :manifestation_checkout_stats do |t|
t.datetime :start_date
t.datetime :end_date
t.text :note
t.timestamps
end
end
def down
drop_table :manifestation_checkout_stats
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20150923173139_add_url_to_classification.rb | db/migrate/20150923173139_add_url_to_classification.rb | class AddUrlToClassification < ActiveRecord::Migration[4.2]
def change
add_column :classifications, :url, :string
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb | db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb | class AddLftAndRgtToClassification < ActiveRecord::Migration[4.2]
def up
add_column :classifications, :lft, :integer
add_column :classifications, :rgt, :integer
end
def down
remove_column :classifications, :rgt
remove_column :classifications, :lft
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20080830154109_create_realizes.rb | db/migrate/20080830154109_create_realizes.rb | class CreateRealizes < ActiveRecord::Migration[4.2]
def change
create_table :realizes do |t|
t.references :agent, null: false
t.references :expression, null: false
t.integer :position
t.timestamps
end
add_index :realizes, :agent_id
add_index :realizes, :expression_id
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb | db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb | class AddLatitudeAndLongitudeToLibrary < ActiveRecord::Migration[4.2]
def change
add_column :libraries, :latitude, :float
add_column :libraries, :longitude, :float
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20081212151614_create_bookmark_stats.rb | db/migrate/20081212151614_create_bookmark_stats.rb | class CreateBookmarkStats < ActiveRecord::Migration[4.2]
def change
create_table :bookmark_stats do |t|
t.datetime :start_date
t.datetime :end_date
t.datetime :started_at
t.datetime :completed_at
t.text :note
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160703190738_add_most_recent_to_order_list_transitions.rb | db/migrate/20160703190738_add_most_recent_to_order_list_transitions.rb | class AddMostRecentToOrderListTransitions < ActiveRecord::Migration[6.1]
def up
add_column :order_list_transitions, :most_recent, :boolean, null: true, if_not_exists: true
end
def down
remove_column :order_list_transitions, :most_recent
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20240823152530_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | db/migrate/20240823152530_add_tenant_to_taggings.acts_as_taggable_on_engine.rb | # frozen_string_literal: true
# This migration comes from acts_as_taggable_on_engine (originally 7)
class AddTenantToTaggings < ActiveRecord::Migration[6.0]
def self.up
add_column ActsAsTaggableOn.taggings_table, :tenant, :string, limit: 128
add_index ActsAsTaggableOn.taggings_table, :tenant unless index_exists? ActsAsTaggableOn.taggings_table, :tenant
end
def self.down
remove_index ActsAsTaggableOn.taggings_table, :tenant
remove_column ActsAsTaggableOn.taggings_table, :tenant
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20140614141500_create_resource_export_file_transitions.rb | db/migrate/20140614141500_create_resource_export_file_transitions.rb | class CreateResourceExportFileTransitions < ActiveRecord::Migration[4.2]
def change
create_table :resource_export_file_transitions do |t|
t.string :to_state
if ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.try(:match, /mysql/)
t.text :metadata
else
t.text :metadata, default: "{}"
end
t.integer :sort_key
t.integer :resource_export_file_id
t.timestamps
end
add_index :resource_export_file_transitions, :resource_export_file_id, name: "index_resource_export_file_transitions_on_file_id"
add_index :resource_export_file_transitions, [:sort_key, :resource_export_file_id], unique: true, name: "index_resource_export_file_transitions_on_sort_key_and_file_id"
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb | db/migrate/20120413072700_add_picture_meta_to_picture_file.rb | class AddPictureMetaToPictureFile < ActiveRecord::Migration[4.2]
def change
add_column :picture_files, :picture_meta, :text
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20231027175624_add_unique_index_to_items_on_item_identifier.rb | db/migrate/20231027175624_add_unique_index_to_items_on_item_identifier.rb | class AddUniqueIndexToItemsOnItemIdentifier < ActiveRecord::Migration[6.1]
def change
remove_index :items, :item_identifier
add_index :items, :item_identifier, unique: true, where: "item_identifier != '' AND item_identifier IS NOT NULL"
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20090720091429_create_content_types.rb | db/migrate/20090720091429_create_content_types.rb | class CreateContentTypes < ActiveRecord::Migration[4.2]
def change
create_table :content_types do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position
t.timestamps
end
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
next-l/enju_leaf | https://github.com/next-l/enju_leaf/blob/cd3cff6dcc8e67909e1cd0a12c38700b45af6a42/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb | db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb | class AddAttachmentAttachmentToCarrierTypes < ActiveRecord::Migration[4.2]
def up
change_table :carrier_types do |t|
t.string :attachment_content_type
t.string :attachment_file_name
t.integer :attachment_file_size
t.datetime :attachment_updated_at
end
end
def down
remove_column :carrier_types, :attachment_content_type
remove_column :carrier_types, :attachment_file_name
remove_column :carrier_types, :attachment_file_size
remove_column :carrier_types, :attachment_updated_at
end
end
| ruby | MIT | cd3cff6dcc8e67909e1cd0a12c38700b45af6a42 | 2026-01-04T17:52:15.550406Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.