spec/dummy/db/schema.rb in enju_leaf-1.3.6 vs spec/dummy/db/schema.rb in enju_leaf-2.0.0.beta.1

- old
+ new

@@ -8,36 +8,62 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_01_02_162311) do +ActiveRecord::Schema.define(version: 2019_07_12_163038) do - create_table "accepts", force: :cascade do |t| + # These are extensions that must be enabled in order to support this database + enable_extension "pgcrypto" + enable_extension "plpgsql" + + create_table "accepts", id: :serial, force: :cascade do |t| t.integer "basket_id" t.integer "item_id" t.integer "librarian_id" t.datetime "created_at" t.datetime "updated_at" t.index ["basket_id"], name: "index_accepts_on_basket_id" t.index ["item_id"], name: "index_accepts_on_item_id" t.index ["librarian_id"], name: "index_accepts_on_librarian_id" end - create_table "agent_import_file_transitions", force: :cascade do |t| + create_table "active_storage_attachments", force: :cascade do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", force: :cascade do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.bigint "byte_size", null: false + t.string "checksum", null: false + t.datetime "created_at", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + + create_table "agent_import_file_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "agent_import_file_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false + t.index ["agent_import_file_id", "most_recent"], name: "index_agent_import_file_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["agent_import_file_id"], name: "index_agent_import_file_transitions_on_agent_import_file_id" t.index ["sort_key", "agent_import_file_id"], name: "index_agent_import_file_transitions_on_sort_key_and_file_id", unique: true end - create_table "agent_import_files", force: :cascade do |t| + create_table "agent_import_files", id: :serial, force: :cascade do |t| t.integer "parent_id" t.string "content_type" t.integer "size" t.integer "user_id" t.text "note" @@ -54,63 +80,65 @@ t.string "user_encoding" t.index ["parent_id"], name: "index_agent_import_files_on_parent_id" t.index ["user_id"], name: "index_agent_import_files_on_user_id" end - create_table "agent_import_results", force: :cascade do |t| + create_table "agent_import_results", id: :serial, force: :cascade do |t| t.integer "agent_import_file_id" t.integer "agent_id" t.text "body" t.datetime "created_at" t.datetime "updated_at" end - create_table "agent_merge_lists", force: :cascade do |t| + create_table "agent_merge_lists", id: :serial, force: :cascade do |t| t.string "title" t.datetime "created_at" t.datetime "updated_at" end - create_table "agent_merges", force: :cascade do |t| + create_table "agent_merges", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "agent_merge_list_id", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["agent_id"], name: "index_agent_merges_on_agent_id" t.index ["agent_merge_list_id"], name: "index_agent_merges_on_agent_merge_list_id" end - create_table "agent_relationship_types", force: :cascade do |t| + create_table "agent_relationship_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "agent_relationships", force: :cascade do |t| + create_table "agent_relationships", id: :serial, force: :cascade do |t| t.integer "parent_id" t.integer "child_id" t.integer "agent_relationship_type_id" t.datetime "created_at" t.datetime "updated_at" t.integer "position" t.index ["child_id"], name: "index_agent_relationships_on_child_id" t.index ["parent_id"], name: "index_agent_relationships_on_parent_id" end - create_table "agent_types", force: :cascade do |t| + create_table "agent_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "agents", force: :cascade do |t| + create_table "agents", id: :serial, force: :cascade do |t| t.string "last_name" t.string "middle_name" t.string "first_name" t.string "last_name_transcription" t.string "middle_name_transcription" @@ -161,20 +189,20 @@ t.index ["language_id"], name: "index_agents_on_language_id" t.index ["profile_id"], name: "index_agents_on_profile_id" t.index ["required_role_id"], name: "index_agents_on_required_role_id" end - create_table "baskets", force: :cascade do |t| + create_table "baskets", id: :serial, force: :cascade do |t| t.integer "user_id" t.text "note" t.integer "lock_version", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" t.index ["user_id"], name: "index_baskets_on_user_id" end - create_table "bookstores", force: :cascade do |t| + create_table "bookstores", id: :serial, force: :cascade do |t| t.text "name", null: false t.string "zip_code" t.text "address" t.text "note" t.string "telephone_number" @@ -184,57 +212,64 @@ t.datetime "deleted_at" t.datetime "created_at" t.datetime "updated_at" end - create_table "budget_types", force: :cascade do |t| + create_table "budget_types", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "carrier_types", force: :cascade do |t| + create_table "carrier_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.string "attachment_file_name" + t.string "attachment_content_type" + t.bigint "attachment_file_size" + t.datetime "attachment_updated_at" + t.jsonb "display_name_translations", default: {}, null: false end create_table "circulation_statuses", force: :cascade do |t| t.string "name", null: false - t.text "display_name" + t.jsonb "display_name", default: {}, null: false t.text "note" t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "colors", force: :cascade do |t| + create_table "colors", id: :serial, force: :cascade do |t| t.integer "library_group_id" t.string "property" t.string "code" t.integer "position" t.datetime "created_at" t.datetime "updated_at" t.index ["library_group_id"], name: "index_colors_on_library_group_id" end - create_table "content_types", force: :cascade do |t| + create_table "content_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "countries", force: :cascade do |t| + create_table "countries", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.string "alpha_2" t.string "alpha_3" t.string "numeric_3" @@ -244,49 +279,62 @@ t.index ["alpha_3"], name: "index_countries_on_alpha_3" t.index ["name"], name: "index_countries_on_name" t.index ["numeric_3"], name: "index_countries_on_numeric_3" end - create_table "create_types", force: :cascade do |t| + create_table "create_types", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "creates", force: :cascade do |t| + create_table "creates", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "work_id", null: false - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" t.integer "create_type_id" t.index ["agent_id"], name: "index_creates_on_agent_id" t.index ["work_id"], name: "index_creates_on_work_id" end - create_table "donates", force: :cascade do |t| + create_table "doi_records", force: :cascade do |t| + t.string "body", null: false + t.string "display_body", null: false + t.string "source" + t.jsonb "response", default: {}, null: false + t.bigint "manifestation_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["body"], name: "index_doi_records_on_body", unique: true + t.index ["manifestation_id"], name: "index_doi_records_on_manifestation_id" + end + + create_table "donates", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "item_id", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["agent_id"], name: "index_donates_on_agent_id" t.index ["item_id"], name: "index_donates_on_item_id" end - create_table "event_categories", force: :cascade do |t| + create_table "event_categories", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" end - create_table "events", force: :cascade do |t| + create_table "events", id: :serial, force: :cascade do |t| t.integer "library_id", default: 1, null: false t.integer "event_category_id", default: 1, null: false t.string "name" t.text "note" t.datetime "start_at" @@ -298,57 +346,59 @@ t.datetime "updated_at" t.index ["event_category_id"], name: "index_events_on_event_category_id" t.index ["library_id"], name: "index_events_on_library_id" end - create_table "exemplifies", force: :cascade do |t| + create_table "exemplifies", id: :serial, force: :cascade do |t| t.integer "manifestation_id", null: false t.integer "item_id", null: false t.integer "position" t.datetime "created_at" t.datetime "updated_at" t.index ["item_id"], name: "index_exemplifies_on_item_id", unique: true t.index ["manifestation_id"], name: "index_exemplifies_on_manifestation_id" end - create_table "extents", force: :cascade do |t| + create_table "extents", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" end - create_table "form_of_works", force: :cascade do |t| + create_table "form_of_works", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "frequencies", force: :cascade do |t| + create_table "frequencies", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "identifier_types", force: :cascade do |t| + create_table "identifier_types", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" end - create_table "identifiers", force: :cascade do |t| + create_table "identifiers", id: :serial, force: :cascade do |t| t.string "body", null: false t.integer "identifier_type_id", null: false t.integer "manifestation_id" t.boolean "primary" t.integer "position" @@ -356,34 +406,73 @@ t.datetime "updated_at" t.index ["body", "identifier_type_id"], name: "index_identifiers_on_body_and_identifier_type_id" t.index ["manifestation_id"], name: "index_identifiers_on_manifestation_id" end - create_table "import_request_transitions", force: :cascade do |t| + create_table "import_request_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "import_request_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false + t.index ["import_request_id", "most_recent"], name: "index_import_request_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["import_request_id"], name: "index_import_request_transitions_on_import_request_id" t.index ["sort_key", "import_request_id"], name: "index_import_request_transitions_on_sort_key_and_request_id", unique: true end - create_table "import_requests", force: :cascade do |t| + create_table "import_requests", id: :serial, force: :cascade do |t| t.string "isbn" t.integer "manifestation_id" t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" t.index ["isbn"], name: "index_import_requests_on_isbn" t.index ["manifestation_id"], name: "index_import_requests_on_manifestation_id" t.index ["user_id"], name: "index_import_requests_on_user_id" end - create_table "items", force: :cascade do |t| + create_table "isbn_record_and_manifestations", force: :cascade do |t| + t.bigint "isbn_record_id", null: false + t.bigint "manifestation_id", null: false + t.integer "position" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["isbn_record_id"], name: "index_isbn_record_and_manifestations_on_isbn_record_id" + t.index ["manifestation_id"], name: "index_isbn_record_and_manifestations_on_manifestation_id" + end + + create_table "isbn_records", force: :cascade do |t| + t.string "body", null: false + t.string "isbn_type" + t.string "source" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["body"], name: "index_isbn_records_on_body", unique: true + end + + create_table "issn_record_and_manifestations", force: :cascade do |t| + t.bigint "issn_record_id", null: false + t.bigint "manifestation_id", null: false + t.integer "position" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["issn_record_id"], name: "index_issn_record_and_manifestations_on_issn_record_id" + t.index ["manifestation_id"], name: "index_issn_record_and_manifestations_on_manifestation_id" + end + + create_table "issn_records", force: :cascade do |t| + t.string "body", null: false + t.string "issn_type" + t.string "source" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["body"], name: "index_issn_records_on_body", unique: true + end + + create_table "items", id: :serial, force: :cascade do |t| t.string "call_number" t.string "item_identifier" t.datetime "created_at" t.datetime "updated_at" t.datetime "deleted_at" @@ -408,26 +497,27 @@ t.index ["manifestation_id"], name: "index_items_on_manifestation_id" t.index ["required_role_id"], name: "index_items_on_required_role_id" t.index ["shelf_id"], name: "index_items_on_shelf_id" end - create_table "languages", force: :cascade do |t| + create_table "languages", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "native_name" t.text "display_name" t.string "iso_639_1" t.string "iso_639_2" t.string "iso_639_3" t.text "note" t.integer "position" + t.jsonb "display_name_translations", default: {}, null: false t.index ["iso_639_1"], name: "index_languages_on_iso_639_1" t.index ["iso_639_2"], name: "index_languages_on_iso_639_2" t.index ["iso_639_3"], name: "index_languages_on_iso_639_3" t.index ["name"], name: "index_languages_on_name", unique: true end - create_table "libraries", force: :cascade do |t| + create_table "libraries", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.string "short_display_name", null: false t.string "zip_code" t.text "street" @@ -448,26 +538,16 @@ t.datetime "deleted_at" t.text "opening_hour" t.string "isil" t.float "latitude" t.float "longitude" + t.jsonb "display_name_translations", default: {}, null: false t.index ["library_group_id"], name: "index_libraries_on_library_group_id" t.index ["name"], name: "index_libraries_on_name" end - create_table "library_group_translations", force: :cascade do |t| - t.integer "library_group_id", null: false - t.string "locale", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.text "login_banner" - t.text "footer_banner" - t.index ["library_group_id"], name: "index_library_group_translations_on_library_group_id" - t.index ["locale"], name: "index_library_group_translations_on_locale" - end - - create_table "library_groups", force: :cascade do |t| + create_table "library_groups", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.string "short_name", null: false t.text "my_networks" t.text "old_login_banner" @@ -485,45 +565,54 @@ t.boolean "family_name_first", default: true t.string "screenshot_generator" t.integer "pub_year_facet_range_interval", default: 10 t.integer "user_id" t.boolean "csv_charset_conversion", default: false, null: false + t.string "header_logo_file_name" + t.string "header_logo_content_type" + t.bigint "header_logo_file_size" + t.datetime "header_logo_updated_at" t.text "header_logo_meta" + t.jsonb "display_name_translations", default: {}, null: false + t.jsonb "login_banner_translations", default: {}, null: false + t.jsonb "footer_banner_translations", default: {}, null: false t.index ["short_name"], name: "index_library_groups_on_short_name" t.index ["user_id"], name: "index_library_groups_on_user_id" end - create_table "licenses", force: :cascade do |t| + create_table "licenses", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "display_name" t.text "note" - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "manifestation_relationship_types", force: :cascade do |t| + create_table "manifestation_relationship_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "manifestation_relationships", force: :cascade do |t| + create_table "manifestation_relationships", id: :serial, force: :cascade do |t| t.integer "parent_id" t.integer "child_id" t.integer "manifestation_relationship_type_id" t.datetime "created_at" t.datetime "updated_at" t.integer "position" t.index ["child_id"], name: "index_manifestation_relationships_on_child_id" t.index ["parent_id"], name: "index_manifestation_relationships_on_parent_id" end - create_table "manifestations", force: :cascade do |t| + create_table "manifestations", id: :serial, force: :cascade do |t| t.text "original_title", null: false t.text "title_alternative" t.text "title_transcription" t.string "classification_number" t.string "manifestation_identifier" @@ -551,10 +640,14 @@ 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 + t.string "attachment_file_name" + t.string "attachment_content_type" + t.integer "attachment_file_size" + t.datetime "attachment_updated_at" t.text "title_alternative_transcription" t.text "description" t.text "abstract" t.datetime "available_at" t.datetime "valid_until" @@ -567,10 +660,11 @@ t.integer "issue_number" t.integer "serial_number" t.string "ndc" t.integer "content_type_id", default: 1 t.integer "year_of_publication" + t.text "attachment_meta" t.integer "month_of_publication" t.boolean "fulltext_content" t.boolean "serial" t.text "statement_of_responsibility" t.text "publication_place" @@ -580,94 +674,101 @@ t.index ["date_of_publication"], name: "index_manifestations_on_date_of_publication" t.index ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier" t.index ["updated_at"], name: "index_manifestations_on_updated_at" end - create_table "medium_of_performances", force: :cascade do |t| + create_table "medium_of_performances", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end create_table "message_request_transitions", force: :cascade do |t| t.string "to_state" - t.text "metadata", default: "{}" + t.jsonb "metadata", default: {} t.integer "sort_key" - t.integer "message_request_id" - t.datetime "created_at" - t.datetime "updated_at" + t.bigint "message_request_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "most_recent", null: false + t.index ["message_request_id", "most_recent"], name: "index_message_request_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["message_request_id"], name: "index_message_request_transitions_on_message_request_id" t.index ["sort_key", "message_request_id"], name: "index_message_request_transitions_on_sort_key_and_request_id", unique: true end create_table "message_requests", force: :cascade do |t| - t.integer "sender_id" - t.integer "receiver_id" - t.integer "message_template_id" + t.bigint "sender_id" + t.bigint "receiver_id" + t.bigint "message_template_id" t.datetime "sent_at" t.datetime "deleted_at" t.text "body" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["message_template_id"], name: "index_message_requests_on_message_template_id" + t.index ["receiver_id"], name: "index_message_requests_on_receiver_id" + t.index ["sender_id"], name: "index_message_requests_on_sender_id" end create_table "message_templates", force: :cascade do |t| t.string "status", null: false t.text "title", null: false t.text "body", null: false t.integer "position" t.string "locale", default: "en" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["status"], name: "index_message_templates_on_status", unique: true end create_table "message_transitions", force: :cascade do |t| t.string "to_state" - t.text "metadata", default: "{}" + t.jsonb "metadata", default: {} t.integer "sort_key" - t.integer "message_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "most_recent" + t.bigint "message_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "most_recent", null: false + t.index ["message_id", "most_recent"], name: "index_message_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["message_id"], name: "index_message_transitions_on_message_id" t.index ["sort_key", "message_id"], name: "index_message_transitions_on_sort_key_and_message_id", unique: true end create_table "messages", force: :cascade do |t| t.datetime "read_at" - t.integer "receiver_id" - t.integer "sender_id" + t.bigint "sender_id" + t.bigint "receiver_id" t.string "subject", null: false t.text "body" - t.integer "message_request_id" - t.integer "parent_id" - t.datetime "created_at" - t.datetime "updated_at" + t.bigint "message_request_id" + t.bigint "parent_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "lft" t.integer "rgt" t.integer "depth" t.index ["message_request_id"], name: "index_messages_on_message_request_id" t.index ["parent_id"], name: "index_messages_on_parent_id" t.index ["receiver_id"], name: "index_messages_on_receiver_id" t.index ["sender_id"], name: "index_messages_on_sender_id" end - create_table "owns", force: :cascade do |t| + create_table "owns", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "item_id", null: false - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" t.index ["agent_id"], name: "index_owns_on_agent_id" t.index ["item_id"], name: "index_owns_on_item_id" end - create_table "picture_files", force: :cascade do |t| + create_table "picture_files", id: :serial, force: :cascade do |t| t.integer "picture_attachable_id" t.string "picture_attachable_type" t.string "content_type" t.text "title" t.string "thumbnail" @@ -683,31 +784,32 @@ t.integer "picture_width" t.integer "picture_height" t.index ["picture_attachable_id", "picture_attachable_type"], name: "index_picture_files_on_picture_attachable_id_and_type" end - create_table "produce_types", force: :cascade do |t| + create_table "produce_types", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "produces", force: :cascade do |t| + create_table "produces", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "manifestation_id", null: false - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" t.integer "produce_type_id" t.index ["agent_id"], name: "index_produces_on_agent_id" t.index ["manifestation_id"], name: "index_produces_on_manifestation_id" end - create_table "profiles", force: :cascade do |t| + create_table "profiles", id: :serial, force: :cascade do |t| t.integer "user_id" t.integer "user_group_id" t.integer "library_id" t.string "locale" t.string "user_number" @@ -719,88 +821,95 @@ t.datetime "updated_at" t.datetime "expired_at" t.boolean "save_search_history" t.text "full_name_transcription" t.datetime "date_of_birth" + t.index ["library_id"], name: "index_profiles_on_library_id" + t.index ["user_group_id"], name: "index_profiles_on_user_group_id" t.index ["user_id"], name: "index_profiles_on_user_id" t.index ["user_number"], name: "index_profiles_on_user_number", unique: true end - create_table "realize_types", force: :cascade do |t| + create_table "realize_types", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "realizes", force: :cascade do |t| + create_table "realizes", id: :serial, force: :cascade do |t| t.integer "agent_id", null: false t.integer "expression_id", null: false - t.integer "position" + t.integer "position", default: 1, null: false t.datetime "created_at" t.datetime "updated_at" t.integer "realize_type_id" t.index ["agent_id"], name: "index_realizes_on_agent_id" t.index ["expression_id"], name: "index_realizes_on_expression_id" end - create_table "request_status_types", force: :cascade do |t| + create_table "request_status_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "request_types", force: :cascade do |t| + create_table "request_types", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "resource_export_file_transitions", force: :cascade do |t| + create_table "resource_export_file_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "resource_export_file_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false + t.index ["resource_export_file_id", "most_recent"], name: "index_resource_export_file_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["resource_export_file_id"], name: "index_resource_export_file_transitions_on_file_id" t.index ["sort_key", "resource_export_file_id"], name: "index_resource_export_file_transitions_on_sort_key_and_file_id", unique: true end - create_table "resource_export_files", force: :cascade do |t| + create_table "resource_export_files", id: :serial, force: :cascade do |t| t.integer "user_id" t.string "resource_export_file_name" t.string "resource_export_content_type" - t.integer "resource_export_file_size" + t.bigint "resource_export_file_size" t.datetime "resource_export_updated_at" t.datetime "executed_at" t.datetime "created_at" t.datetime "updated_at" end - create_table "resource_import_file_transitions", force: :cascade do |t| + create_table "resource_import_file_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "resource_import_file_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false + t.index ["resource_import_file_id", "most_recent"], name: "index_resource_import_file_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["resource_import_file_id"], name: "index_resource_import_file_transitions_on_file_id" t.index ["sort_key", "resource_import_file_id"], name: "index_resource_import_file_transitions_on_sort_key_and_file_id", unique: true end - create_table "resource_import_files", force: :cascade do |t| + create_table "resource_import_files", id: :serial, force: :cascade do |t| t.integer "parent_id" t.string "content_type" t.integer "size" t.integer "user_id" t.text "note" @@ -818,11 +927,11 @@ t.integer "default_shelf_id" t.index ["parent_id"], name: "index_resource_import_files_on_parent_id" t.index ["user_id"], name: "index_resource_import_files_on_user_id" end - create_table "resource_import_results", force: :cascade do |t| + create_table "resource_import_results", id: :serial, force: :cascade do |t| t.integer "resource_import_file_id" t.integer "manifestation_id" t.integer "item_id" t.text "body" t.datetime "created_at" @@ -831,21 +940,22 @@ t.index ["item_id"], name: "index_resource_import_results_on_item_id" t.index ["manifestation_id"], name: "index_resource_import_results_on_manifestation_id" t.index ["resource_import_file_id"], name: "index_resource_import_results_on_resource_import_file_id" end - create_table "roles", force: :cascade do |t| + create_table "roles", id: :serial, force: :cascade do |t| t.string "name", null: false t.string "display_name" t.text "note" t.datetime "created_at" t.datetime "updated_at" t.integer "score", default: 0, null: false t.integer "position" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "search_engines", force: :cascade do |t| + create_table "search_engines", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.string "url", null: false t.text "base_url", null: false t.text "http_method", null: false @@ -853,13 +963,14 @@ t.text "additional_param" t.text "note" t.integer "position" t.datetime "created_at" t.datetime "updated_at" + t.jsonb "display_name_translations", default: {}, null: false end - create_table "search_histories", force: :cascade do |t| + create_table "search_histories", id: :serial, force: :cascade do |t| t.integer "user_id" t.string "operation", default: "searchRetrieve" t.float "sru_version", default: 1.2 t.string "query" t.integer "start_record" @@ -880,44 +991,44 @@ t.datetime "created_at" t.datetime "updated_at" t.index ["user_id"], name: "index_search_histories_on_user_id" end - create_table "series_has_manifestations", force: :cascade do |t| + create_table "series_has_manifestations", id: :serial, force: :cascade do |t| t.integer "series_statement_id" t.integer "manifestation_id" t.integer "position" t.datetime "created_at" t.datetime "updated_at" t.index ["manifestation_id"], name: "index_series_has_manifestations_on_manifestation_id" t.index ["series_statement_id"], name: "index_series_has_manifestations_on_series_statement_id" end - create_table "series_statement_merge_lists", force: :cascade do |t| + create_table "series_statement_merge_lists", id: :serial, force: :cascade do |t| t.string "title" t.datetime "created_at" t.datetime "updated_at" end - create_table "series_statement_merges", force: :cascade do |t| + create_table "series_statement_merges", id: :serial, force: :cascade do |t| t.integer "series_statement_id", null: false t.integer "series_statement_merge_list_id", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["series_statement_id"], name: "index_series_statement_merges_on_series_statement_id" t.index ["series_statement_merge_list_id"], name: "index_series_statement_merges_on_list_id" end - create_table "series_statement_relationships", force: :cascade do |t| + create_table "series_statement_relationships", id: :serial, force: :cascade do |t| t.integer "parent_id" t.integer "child_id" t.integer "position" t.datetime "created_at" t.datetime "updated_at" end - create_table "series_statements", force: :cascade do |t| + create_table "series_statements", id: :serial, force: :cascade do |t| t.text "original_title" t.text "numbering" t.text "title_subseries" t.text "numbering_subseries" t.integer "position" @@ -938,36 +1049,37 @@ t.index ["manifestation_id"], name: "index_series_statements_on_manifestation_id" t.index ["root_manifestation_id"], name: "index_series_statements_on_root_manifestation_id" t.index ["series_statement_identifier"], name: "index_series_statements_on_series_statement_identifier" end - create_table "shelves", force: :cascade do |t| + create_table "shelves", id: :serial, force: :cascade do |t| t.string "name", null: false t.text "display_name" t.text "note" t.integer "library_id", null: false t.integer "items_count", default: 0, null: false t.integer "position" t.datetime "created_at" t.datetime "updated_at" t.datetime "deleted_at" t.boolean "closed", default: false, null: false + t.jsonb "display_name_translations", default: {}, null: false t.index ["library_id"], name: "index_shelves_on_library_id" end - create_table "subscribes", force: :cascade do |t| + create_table "subscribes", id: :serial, force: :cascade do |t| t.integer "subscription_id", null: false t.integer "work_id", null: false t.datetime "start_at", null: false t.datetime "end_at", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["subscription_id"], name: "index_subscribes_on_subscription_id" t.index ["work_id"], name: "index_subscribes_on_work_id" end - create_table "subscriptions", force: :cascade do |t| + create_table "subscriptions", id: :serial, force: :cascade do |t| t.text "title", null: false t.text "note" t.integer "user_id" t.integer "order_list_id" t.datetime "deleted_at" @@ -976,11 +1088,11 @@ t.datetime "updated_at" t.index ["order_list_id"], name: "index_subscriptions_on_order_list_id" t.index ["user_id"], name: "index_subscriptions_on_user_id" end - create_table "taggings", force: :cascade do |t| + create_table "taggings", id: :serial, force: :cascade do |t| t.integer "tag_id" t.string "taggable_type" t.integer "taggable_id" t.string "tagger_type" t.integer "tagger_id" @@ -988,53 +1100,54 @@ t.datetime "created_at" t.index ["tag_id"], name: "index_taggings_on_tag_id" t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" end - create_table "tags", force: :cascade do |t| + create_table "tags", id: :serial, force: :cascade do |t| t.string "name" t.string "name_transcription" t.datetime "created_at" t.datetime "updated_at" t.integer "taggings_count", default: 0 end create_table "use_restrictions", force: :cascade do |t| t.string "name", null: false - t.text "display_name" + t.jsonb "display_name", default: {}, null: false t.text "note" t.integer "position" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "user_export_file_transitions", force: :cascade do |t| + create_table "user_export_file_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "user_export_file_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false t.index ["sort_key", "user_export_file_id"], name: "index_user_export_file_transitions_on_sort_key_and_file_id", unique: true + t.index ["user_export_file_id", "most_recent"], name: "index_user_export_file_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_file_id" t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_user_export_file_id" end - create_table "user_export_files", force: :cascade do |t| + create_table "user_export_files", id: :serial, force: :cascade do |t| t.integer "user_id" t.string "user_export_file_name" t.string "user_export_content_type" - t.integer "user_export_file_size" + t.bigint "user_export_file_size" t.datetime "user_export_updated_at" t.datetime "executed_at" t.datetime "created_at" t.datetime "updated_at" t.index ["user_id"], name: "index_user_export_files_on_user_id" end - create_table "user_groups", force: :cascade do |t| + create_table "user_groups", id: :serial, force: :cascade do |t| t.string "name" t.text "display_name" t.text "note" t.integer "position" t.datetime "created_at" @@ -1043,34 +1156,36 @@ t.integer "valid_period_for_new_user", default: 0, null: false t.datetime "expired_at" t.integer "number_of_day_to_notify_overdue", default: 1, null: false t.integer "number_of_day_to_notify_due_date", default: 7, null: false t.integer "number_of_time_to_notify_overdue", default: 3, null: false + t.jsonb "display_name_translations", default: {}, null: false end - create_table "user_has_roles", force: :cascade do |t| - t.integer "user_id" - t.integer "role_id" + create_table "user_has_roles", id: :serial, force: :cascade do |t| + t.integer "user_id", null: false + t.integer "role_id", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["role_id"], name: "index_user_has_roles_on_role_id" t.index ["user_id"], name: "index_user_has_roles_on_user_id" end - create_table "user_import_file_transitions", force: :cascade do |t| + create_table "user_import_file_transitions", id: :serial, force: :cascade do |t| t.string "to_state" t.text "metadata", default: "{}" t.integer "sort_key" t.integer "user_import_file_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "most_recent" + t.boolean "most_recent", null: false t.index ["sort_key", "user_import_file_id"], name: "index_user_import_file_transitions_on_sort_key_and_file_id", unique: true + t.index ["user_import_file_id", "most_recent"], name: "index_user_import_file_transitions_parent_most_recent", unique: true, where: "most_recent" t.index ["user_import_file_id"], name: "index_user_import_file_transitions_on_user_import_file_id" end - create_table "user_import_files", force: :cascade do |t| + create_table "user_import_files", id: :serial, force: :cascade do |t| t.integer "user_id" t.text "note" t.datetime "executed_at" t.string "user_import_file_name" t.string "user_import_content_type" @@ -1085,22 +1200,22 @@ t.integer "default_library_id" t.integer "default_user_group_id" t.index ["user_id"], name: "index_user_import_files_on_user_id" end - create_table "user_import_results", force: :cascade do |t| + create_table "user_import_results", id: :serial, force: :cascade do |t| t.integer "user_import_file_id" t.integer "user_id" t.text "body" t.datetime "created_at" t.datetime "updated_at" t.text "error_message" t.index ["user_id"], name: "index_user_import_results_on_user_id" t.index ["user_import_file_id"], name: "index_user_import_results_on_user_import_file_id" end - create_table "users", force: :cascade do |t| + create_table "users", id: :serial, force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" @@ -1117,23 +1232,38 @@ t.datetime "expired_at" t.integer "failed_attempts", default: 0 t.string "unlock_token" t.datetime "locked_at" t.datetime "confirmed_at" + t.bigint "profile_id" t.index ["email"], name: "index_users_on_email" + t.index ["profile_id"], name: "index_users_on_profile_id" t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true t.index ["username"], name: "index_users_on_username", unique: true end - create_table "withdraws", force: :cascade do |t| + create_table "withdraws", id: :serial, force: :cascade do |t| t.integer "basket_id" t.integer "item_id" t.integer "librarian_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["basket_id"], name: "index_withdraws_on_basket_id" t.index ["item_id"], name: "index_withdraws_on_item_id" t.index ["librarian_id"], name: "index_withdraws_on_librarian_id" end + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" + add_foreign_key "doi_records", "manifestations" + add_foreign_key "isbn_record_and_manifestations", "isbn_records" + add_foreign_key "isbn_record_and_manifestations", "manifestations" + add_foreign_key "issn_record_and_manifestations", "issn_records" + add_foreign_key "issn_record_and_manifestations", "manifestations" + add_foreign_key "items", "manifestations" + add_foreign_key "libraries", "library_groups" + add_foreign_key "library_groups", "users" + add_foreign_key "profiles", "users" + add_foreign_key "user_has_roles", "roles" + add_foreign_key "user_has_roles", "users" + add_foreign_key "users", "profiles", on_delete: :cascade end