Skip to content

Commit

Permalink
add dummy migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Jan 2, 2019
1 parent 006370d commit 78529f3
Show file tree
Hide file tree
Showing 71 changed files with 741 additions and 20 deletions.
6 changes: 1 addition & 5 deletions app/helpers/loc_search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ def link_to_import_from_loc(lccn)
if lccn.blank?
t('enju_loc.not_available')
else
identifier_type = IdentifierType.where(name: 'lccn').first
if identifier_type
manifestation = Identifier.where(body: lccn, identifier_type_id: identifier_type
.id).first.try(:manifestation)
end
manifestation = LccnRecord.find_by(body: lccn).try(:manifestation)
unless manifestation
button_to t('enju_loc.add'), loc_search_index_path(book: {lccn: lccn}), method: :post, data: {disable_with: t('page.saving')}
else
Expand Down
13 changes: 0 additions & 13 deletions db/migrate/20081027150907_create_picture_files.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/enju_loc/loc_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def import_record_from_loc(doc)

if isbn
IsbnRecordAndManifestation.create(
isbn_record: IsbnRecord.find_by(body: isbn),
isbn_record: IsbnRecord.where(body: isbn).first_or_create,
manifestation: manifestation
)
end
Expand Down
3 changes: 3 additions & 0 deletions spec/dummy/app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
50 changes: 50 additions & 0 deletions spec/dummy/db/migrate/001_create_agents.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class CreateAgents < ActiveRecord::Migration[4.2]
def change
create_table :agents do |t|
t.string :last_name
t.string :middle_name
t.string :first_name
t.string :last_name_transcription
t.string :middle_name_transcription
t.string :first_name_transcription
t.string :corporate_name
t.string :corporate_name_transcription
t.string :full_name
t.text :full_name_transcription
t.text :full_name_alternative
t.timestamps
t.datetime :deleted_at
t.string :zip_code_1
t.string :zip_code_2
t.text :address_1
t.text :address_2
t.text :address_1_note
t.text :address_2_note
t.string :telephone_number_1
t.string :telephone_number_2
t.string :fax_number_1
t.string :fax_number_2
t.text :other_designation
t.text :place
t.string :postal_code
t.text :street
t.text :locality
t.text :region
t.datetime :date_of_birth
t.datetime :date_of_death
t.integer :language_id, default: 1, null: false
t.integer :country_id, default: 1, null: false
t.integer :agent_type_id, default: 1, null: false
t.integer :lock_version, default: 0, null: false
t.text :note
t.integer :required_role_id, default: 1, null: false
t.integer :required_score, default: 0, null: false
t.text :email
t.text :url
end
add_index :agents, :language_id
add_index :agents, :country_id
add_index :agents, :required_role_id
add_index :agents, :full_name
end
end
43 changes: 43 additions & 0 deletions spec/dummy/db/migrate/005_create_manifestations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class CreateManifestations < ActiveRecord::Migration[4.2]
def change
create_table :manifestations do |t|
t.text :original_title, null: false
t.text :title_alternative
t.text :title_transcription
t.string :classification_number
t.string :manifestation_identifier
t.datetime :date_of_publication
t.datetime :copyright_date
t.timestamps
t.datetime :deleted_at
t.string :access_address
t.integer :language_id, default: 1, null: false
t.integer :carrier_type_id, default: 1, null: false
t.integer :start_page
t.integer :end_page
t.integer :height
t.integer :width
t.integer :depth
t.integer :price # TODO: 通貨単位
t.text :fulltext
t.string :volume_number_string
t.string :issue_number_string
t.string :serial_number_string
t.integer :edition
t.text :note
t.boolean :repository_content, default: false, null: false
t.integer :lock_version, default: 0, null: false
t.integer :required_role_id, default: 1, null: false
t.integer :required_score, default: 0, null: false
t.integer :frequency_id, default: 1, null: false
t.boolean :subscription_master, default: false, null: false
end
#add_index :manifestations, :carrier_type_id
#add_index :manifestations, :required_role_id
add_index :manifestations, :access_address
#add_index :manifestations, :frequency_id
add_index :manifestations, :manifestation_identifier
add_index :manifestations, :updated_at
add_index :manifestations, :date_of_publication
end
end
11 changes: 11 additions & 0 deletions spec/dummy/db/migrate/073_create_carrier_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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
12 changes: 12 additions & 0 deletions spec/dummy/db/migrate/117_create_form_of_works.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateFormOfWorks < ActiveRecord::Migration[4.2]
def change
create_table :form_of_works do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position

t.timestamps
end
end
end
28 changes: 28 additions & 0 deletions spec/dummy/db/migrate/20081025083323_create_countries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class CreateCountries < ActiveRecord::Migration[4.2]

# ISO 3166 is the International Standard for country codes.
#
# ISO 3166-1:2006 Codes for the representation of names of countries and their subdivisions - Part 1:
# Country codes which is what most users know as ISO's country codes. First published in 1974, it is has since
# then become one of the world's most popular and most widely used standard solution for coding country names.
# It contains a two-letter code which is recommended as the general purpose code, a three-letter code which has
# better mnenomic properties and a numeric-3 code which can be useful if script independence of the codes is important.
#
# http://www.iso.org/iso/country_codes/background_on_iso_3166/what_is_iso_3166.htm

def change
create_table :countries do |t|
t.string :name, size: 80, null: false
t.text :display_name
t.string :alpha_2, size: 2
t.string :alpha_3, size: 3
t.string :numeric_3, size: 3
t.text :note
t.integer :position
end
add_index :countries, :name
add_index :countries, :alpha_2
add_index :countries, :alpha_3
add_index :countries, :numeric_3
end
end
23 changes: 23 additions & 0 deletions spec/dummy/db/migrate/20081025083905_create_languages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class CreateLanguages < ActiveRecord::Migration[4.2]

# ISO 639 is the set of international standards that lists short codes for language names.
# Note this doesn't include macrolanguages (dialects)
# Information on macrolanguages http://en.wikipedia.org/wiki/ISO_639_macrolanguage

def change
create_table :languages do |t|
t.string :name, null: false
t.string :native_name
t.text :display_name
t.string :iso_639_1, size: 3
t.string :iso_639_2, size: 3
t.string :iso_639_3, size: 3
t.text :note
t.integer :position
end
add_index :languages, :name, unique: true
add_index :languages, :iso_639_1
add_index :languages, :iso_639_2
add_index :languages, :iso_639_3
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
12 changes: 12 additions & 0 deletions spec/dummy/db/migrate/20090720091429_create_content_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateAgentRelationshipTypes < ActiveRecord::Migration[4.2]
def change
create_table :agent_relationship_types do |t|
t.string :name, null: false
t.text :display_name
t.text :note
t.integer :position

t.timestamps
end
end
end
27 changes: 27 additions & 0 deletions spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class AddDcndlSchema < ActiveRecord::Migration[4.2]
def self.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 self.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
13 changes: 13 additions & 0 deletions spec/dummy/db/migrate/20091214131723_create_series_statements.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateSeriesStatements < ActiveRecord::Migration[4.2]
def change
create_table :series_statements do |t|
t.text :title
t.text :numbering
t.text :title_subseries
t.text :numbering_subseries
t.integer :position

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class RenameSeriesStatementTitleToOriginalTitle < ActiveRecord::Migration[4.2]
def self.up
rename_column :series_statements, :title, :original_title
add_column :series_statements, :title_transcription, :text
add_column :series_statements, :title_alternative, :text
end

def self.down
rename_column :series_statements, :original_title, :title
remove_column :series_statements, :title_transcription
remove_column :series_statements, :title_alternative
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddSeriesStatementIdentifierToSeriesStatement < ActiveRecord::Migration[4.2]
def self.up
add_column :series_statements, :series_statement_identifier, :string
add_index :series_statements, :series_statement_identifier
end

def self.down
remove_column :series_statements, :series_statement_identifier
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AddPositionToAgentRelationship < ActiveRecord::Migration[4.2]
def self.up
add_column :manifestation_relationships, :position, :integer
add_column :agent_relationships, :position, :integer
end

def self.down
remove_column :agent_relationships, :position
remove_column :manifestation_relationships, :position
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateAgentImportResults < ActiveRecord::Migration[4.2]
def change
create_table :agent_import_results do |t|
t.integer :agent_import_file_id
t.integer :agent_id
t.text :body

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddAcquiredAtToItem < ActiveRecord::Migration[4.2]
def self.up
add_column :items, :acquired_at, :timestamp
end

def self.down
remove_column :items, :acquired_at
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddPubDateToManifestation < ActiveRecord::Migration[4.2]
def self.up
add_column :manifestations, :pub_date, :string
end

def self.down
remove_column :manifestations, :pub_date
end
end
Loading

0 comments on commit 78529f3

Please sign in to comment.