enju_seed 0.3.0.beta.2 → 0.3.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/my_accounts_controller.rb +4 -4
  3. data/app/models/concerns/enju_seed/enju_user.rb +1 -1
  4. data/app/models/concerns/master_model.rb +1 -11
  5. data/app/models/identity.rb +1 -1
  6. data/app/models/profile.rb +6 -8
  7. data/app/models/role.rb +10 -27
  8. data/app/models/user_has_role.rb +2 -2
  9. data/app/policies/user_export_file_policy.rb +21 -0
  10. data/app/policies/user_import_file_policy.rb +21 -0
  11. data/app/policies/user_import_result_policy.rb +21 -0
  12. data/app/views/my_accounts/_edit_credential.html.slim +6 -6
  13. data/app/views/my_accounts/show.html.slim +1 -1
  14. data/app/views/profiles/_edit_credential.html.erb +6 -6
  15. data/app/views/profiles/_edit_credential.html.slim +6 -6
  16. data/app/views/profiles/new.html.slim +3 -3
  17. data/app/views/roles/index.html.slim +1 -1
  18. data/app/views/roles/show.html.slim +1 -1
  19. data/db/migrate/041_create_roles.rb +5 -6
  20. data/db/migrate/20100606065209_create_user_has_roles.rb +3 -3
  21. data/db/migrate/20140122054321_create_profiles.rb +5 -13
  22. data/db/migrate/20140811031145_add_expired_at_to_profile.rb +1 -1
  23. data/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +1 -1
  24. data/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +1 -1
  25. data/db/migrate/20150421023923_create_identities.rb +4 -6
  26. data/db/migrate/20151126005552_add_provider_to_identity.rb +2 -2
  27. data/db/migrate/20170114174536_add_profile_id_to_user.rb +5 -0
  28. data/lib/enju_seed/engine.rb +2 -0
  29. data/lib/enju_seed/version.rb +1 -1
  30. data/spec/controllers/my_accounts_controller_spec.rb +0 -12
  31. data/spec/controllers/profiles_controller_spec.rb +24 -21
  32. data/spec/controllers/roles_controller_spec.rb +1 -1
  33. data/spec/dummy/db/migrate/005_create_manifestations.rb +12 -13
  34. data/spec/dummy/db/migrate/006_create_items.rb +7 -8
  35. data/spec/dummy/db/migrate/012_create_owns.rb +3 -5
  36. data/spec/dummy/db/migrate/015_create_creates.rb +3 -5
  37. data/spec/dummy/db/migrate/047_create_produces.rb +3 -5
  38. data/spec/dummy/db/migrate/059_create_libraries.rb +9 -10
  39. data/spec/dummy/db/migrate/069_create_shelves.rb +5 -6
  40. data/spec/dummy/db/migrate/073_create_carrier_types.rb +3 -3
  41. data/spec/dummy/db/migrate/077_create_user_groups.rb +4 -4
  42. data/spec/dummy/db/migrate/080_create_library_groups.rb +6 -7
  43. data/spec/dummy/db/migrate/112_create_frequencies.rb +3 -3
  44. data/spec/dummy/db/migrate/117_create_form_of_works.rb +3 -3
  45. data/spec/dummy/db/migrate/120_create_baskets.rb +3 -4
  46. data/spec/dummy/db/migrate/124_create_bookstores.rb +3 -3
  47. data/spec/dummy/db/migrate/130_create_request_status_types.rb +3 -3
  48. data/spec/dummy/db/migrate/131_create_request_types.rb +3 -3
  49. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +3 -5
  50. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +2 -4
  51. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -5
  52. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +5 -7
  53. data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +3 -3
  54. data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +3 -3
  55. data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +4 -7
  56. data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +1 -1
  57. data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +4 -6
  58. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
  59. data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +4 -5
  60. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +2 -2
  61. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
  62. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -4
  63. data/spec/dummy/db/migrate/20140529014410_create_item_transitions.rb +15 -0
  64. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
  65. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -5
  66. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
  67. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
  68. data/spec/dummy/db/migrate/20140802082007_add_manifestation_id_to_item.rb +2 -3
  69. data/spec/dummy/db/migrate/20141029131633_create_periodicals.rb +2 -2
  70. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
  71. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +2 -2
  72. data/spec/dummy/db/migrate/20151216123621_create_doi_records.rb +4 -4
  73. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +4 -4
  74. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +4 -4
  75. data/spec/dummy/db/schema.rb +173 -144
  76. data/spec/factories/profile.rb +4 -4
  77. data/spec/factories/user.rb +3 -0
  78. data/spec/fixtures/libraries.yml +37 -37
  79. data/spec/fixtures/library_groups.yml +27 -20
  80. data/spec/fixtures/profiles.yml +27 -35
  81. data/spec/fixtures/roles.yml +12 -12
  82. data/spec/fixtures/user_groups.yml +20 -10
  83. data/spec/fixtures/user_has_roles.yml +2 -2
  84. data/spec/fixtures/users.yml +7 -0
  85. data/spec/models/profile_spec.rb +7 -9
  86. data/spec/models/role_spec.rb +10 -11
  87. data/spec/models/user_has_role_spec.rb +3 -4
  88. data/spec/models/user_spec.rb +0 -1
  89. metadata +33 -20
  90. data/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +0 -11
  91. data/spec/dummy/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +0 -5
  92. data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +0 -6
  93. data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +0 -5
@@ -1,9 +1,9 @@
1
- class CreatePeriodicals < ActiveRecord::Migration
1
+ class CreatePeriodicals < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :periodicals do |t|
4
4
  t.text :original_title
5
5
  t.string :periodical_type
6
- t.references :manifestation, index: true, foreign_key: true
6
+ t.references :manifestation, foreign_key: true, type: :uuid
7
7
 
8
8
  t.timestamps
9
9
  end
@@ -1,13 +1,11 @@
1
- class CreateWithdraws < ActiveRecord::Migration
1
+ class CreateWithdraws < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :withdraws do |t|
4
- t.integer :basket_id
5
- t.integer :item_id
4
+ t.references :basket, foreign_key: {on_delete: :nullify}
5
+ t.references :item, foreign_key: true, type: :uuid
6
6
  t.integer :librarian_id
7
7
 
8
8
  t.timestamps null: false
9
9
  end
10
- add_index :withdraws, :basket_id
11
- add_index :withdraws, :item_id
12
10
  end
13
11
  end
@@ -1,5 +1,5 @@
1
- class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration[5.0]
2
2
  def change
3
- add_column :library_groups, :footer_banner, :jsonb
3
+ add_column :library_groups, :footer_banner_translations, :jsonb
4
4
  end
5
5
  end
@@ -1,12 +1,12 @@
1
- class CreateDoiRecords < ActiveRecord::Migration
1
+ class CreateDoiRecords < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :doi_records do |t|
4
- t.string :body, index: true, null: false
4
+ t.string :body, index: {unique: true}, null: false
5
5
  t.string :registration_agency
6
- t.references :manifestation, index: true, null: false
6
+ t.references :manifestation, foreign_key: true, type: :uuid
7
7
  t.string :source
8
8
 
9
- t.timestamps null: false
9
+ t.timestamps
10
10
  end
11
11
  end
12
12
  end
@@ -1,12 +1,12 @@
1
- class CreateIssnRecords < ActiveRecord::Migration
1
+ class CreateIssnRecords < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :issn_records do |t|
4
- t.string :body, index: true, null: false
4
+ t.string :body, index: {unique: true}, null: false
5
5
  t.string :issn_type
6
6
  t.string :source
7
- t.integer :manifestation_id, index: true
7
+ t.references :manifestation, foreign_key: true, type: :uuid
8
8
 
9
- t.timestamps null: false
9
+ t.timestamps
10
10
  end
11
11
  end
12
12
  end
@@ -1,12 +1,12 @@
1
- class CreateIsbnRecords < ActiveRecord::Migration
1
+ class CreateIsbnRecords < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  create_table :isbn_records do |t|
4
- t.string :body, index: true, null: false
4
+ t.string :body, index: {unique: true}, null: false
5
5
  t.string :isbn_type
6
6
  t.string :source
7
- t.references :manifestation, index: true, foreign_key: true
7
+ t.references :manifestation, foreign_key: true, type: :uuid
8
8
 
9
- t.timestamps null: false
9
+ t.timestamps
10
10
  end
11
11
  end
12
12
  end
@@ -10,17 +10,18 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20161115184756) do
13
+ ActiveRecord::Schema.define(version: 20170114174536) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
17
+ enable_extension "pgcrypto"
17
18
 
18
19
  create_table "accepts", force: :cascade do |t|
19
20
  t.integer "basket_id"
20
- t.integer "item_id"
21
+ t.uuid "item_id"
21
22
  t.integer "librarian_id"
22
- t.datetime "created_at"
23
- t.datetime "updated_at"
23
+ t.datetime "created_at", null: false
24
+ t.datetime "updated_at", null: false
24
25
  t.index ["basket_id"], name: "index_accepts_on_basket_id", using: :btree
25
26
  t.index ["item_id"], name: "index_accepts_on_item_id", using: :btree
26
27
  end
@@ -191,13 +192,13 @@ ActiveRecord::Schema.define(version: 20161115184756) do
191
192
  t.integer "user_id"
192
193
  t.text "note"
193
194
  t.integer "lock_version", default: 0, null: false
194
- t.datetime "created_at"
195
- t.datetime "updated_at"
195
+ t.datetime "created_at", null: false
196
+ t.datetime "updated_at", null: false
196
197
  t.index ["user_id"], name: "index_baskets_on_user_id", using: :btree
197
198
  end
198
199
 
199
- create_table "bookstores", force: :cascade do |t|
200
- t.text "name", null: false
200
+ create_table "bookstores", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
201
+ t.string "name", null: false
201
202
  t.string "zip_code"
202
203
  t.text "address"
203
204
  t.text "note"
@@ -206,8 +207,8 @@ ActiveRecord::Schema.define(version: 20161115184756) do
206
207
  t.string "url"
207
208
  t.integer "position"
208
209
  t.datetime "deleted_at"
209
- t.datetime "created_at"
210
- t.datetime "updated_at"
210
+ t.datetime "created_at", null: false
211
+ t.datetime "updated_at", null: false
211
212
  end
212
213
 
213
214
  create_table "budget_types", force: :cascade do |t|
@@ -231,12 +232,12 @@ ActiveRecord::Schema.define(version: 20161115184756) do
231
232
  end
232
233
 
233
234
  create_table "carrier_types", force: :cascade do |t|
234
- t.string "name", null: false
235
- t.text "display_name"
235
+ t.string "name", null: false
236
+ t.jsonb "display_name_translations"
236
237
  t.text "note"
237
238
  t.integer "position"
238
- t.datetime "created_at"
239
- t.datetime "updated_at"
239
+ t.datetime "created_at", null: false
240
+ t.datetime "updated_at", null: false
240
241
  t.string "attachment_id"
241
242
  t.string "attachment_filename"
242
243
  t.integer "attachment_size"
@@ -340,12 +341,12 @@ ActiveRecord::Schema.define(version: 20161115184756) do
340
341
  end
341
342
 
342
343
  create_table "content_types", force: :cascade do |t|
343
- t.string "name", null: false
344
- t.text "display_name"
344
+ t.string "name", null: false
345
+ t.jsonb "display_name_translations"
345
346
  t.text "note"
346
347
  t.integer "position"
347
- t.datetime "created_at"
348
- t.datetime "updated_at"
348
+ t.datetime "created_at", null: false
349
+ t.datetime "updated_at", null: false
349
350
  t.string "attachment_id"
350
351
  t.string "attachment_filename"
351
352
  t.integer "attachment_size"
@@ -378,10 +379,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
378
379
 
379
380
  create_table "creates", force: :cascade do |t|
380
381
  t.integer "agent_id", null: false
381
- t.integer "work_id", null: false
382
+ t.uuid "work_id", null: false
382
383
  t.integer "position"
383
- t.datetime "created_at"
384
- t.datetime "updated_at"
384
+ t.datetime "created_at", null: false
385
+ t.datetime "updated_at", null: false
385
386
  t.integer "create_type_id"
386
387
  t.index ["agent_id"], name: "index_creates_on_agent_id", using: :btree
387
388
  t.index ["work_id"], name: "index_creates_on_work_id", using: :btree
@@ -401,11 +402,11 @@ ActiveRecord::Schema.define(version: 20161115184756) do
401
402
  create_table "doi_records", force: :cascade do |t|
402
403
  t.string "body", null: false
403
404
  t.string "registration_agency"
404
- t.integer "manifestation_id", null: false
405
+ t.uuid "manifestation_id"
405
406
  t.string "source"
406
407
  t.datetime "created_at", null: false
407
408
  t.datetime "updated_at", null: false
408
- t.index ["body"], name: "index_doi_records_on_body", using: :btree
409
+ t.index ["body"], name: "index_doi_records_on_body", unique: true, using: :btree
409
410
  t.index ["manifestation_id"], name: "index_doi_records_on_manifestation_id", using: :btree
410
411
  end
411
412
 
@@ -419,31 +420,30 @@ ActiveRecord::Schema.define(version: 20161115184756) do
419
420
  end
420
421
 
421
422
  create_table "exemplifies", force: :cascade do |t|
422
- t.integer "manifestation_id", null: false
423
- t.integer "item_id", null: false
423
+ t.uuid "manifestation_id", null: false
424
+ t.uuid "item_id", null: false
424
425
  t.integer "position"
425
426
  t.datetime "created_at"
426
427
  t.datetime "updated_at"
427
428
  t.index ["item_id"], name: "index_exemplifies_on_item_id", unique: true, using: :btree
428
- t.index ["manifestation_id"], name: "index_exemplifies_on_manifestation_id", using: :btree
429
429
  end
430
430
 
431
431
  create_table "form_of_works", force: :cascade do |t|
432
- t.string "name", null: false
433
- t.text "display_name"
432
+ t.string "name", null: false
433
+ t.jsonb "display_name_translations"
434
434
  t.text "note"
435
435
  t.integer "position"
436
- t.datetime "created_at"
437
- t.datetime "updated_at"
436
+ t.datetime "created_at", null: false
437
+ t.datetime "updated_at", null: false
438
438
  end
439
439
 
440
440
  create_table "frequencies", force: :cascade do |t|
441
- t.string "name", null: false
442
- t.text "display_name"
441
+ t.string "name", null: false
442
+ t.jsonb "display_name_translations"
443
443
  t.text "note"
444
444
  t.integer "position"
445
- t.datetime "created_at"
446
- t.datetime "updated_at"
445
+ t.datetime "created_at", null: false
446
+ t.datetime "updated_at", null: false
447
447
  end
448
448
 
449
449
  create_table "identifier_types", force: :cascade do |t|
@@ -458,11 +458,11 @@ ActiveRecord::Schema.define(version: 20161115184756) do
458
458
  create_table "identifiers", force: :cascade do |t|
459
459
  t.string "body", null: false
460
460
  t.integer "identifier_type_id", null: false
461
- t.integer "manifestation_id"
461
+ t.uuid "manifestation_id"
462
462
  t.boolean "primary"
463
463
  t.integer "position"
464
- t.datetime "created_at"
465
- t.datetime "updated_at"
464
+ t.datetime "created_at", null: false
465
+ t.datetime "updated_at", null: false
466
466
  t.index ["body", "identifier_type_id"], name: "index_identifiers_on_body_and_identifier_type_id", using: :btree
467
467
  t.index ["manifestation_id"], name: "index_identifiers_on_manifestation_id", using: :btree
468
468
  end
@@ -474,7 +474,7 @@ ActiveRecord::Schema.define(version: 20161115184756) do
474
474
  t.integer "profile_id"
475
475
  t.datetime "created_at", null: false
476
476
  t.datetime "updated_at", null: false
477
- t.string "provider"
477
+ t.string "provider", null: false
478
478
  t.index ["email"], name: "index_identities_on_email", using: :btree
479
479
  t.index ["name"], name: "index_identities_on_name", using: :btree
480
480
  t.index ["profile_id"], name: "index_identities_on_profile_id", using: :btree
@@ -494,10 +494,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
494
494
 
495
495
  create_table "import_requests", force: :cascade do |t|
496
496
  t.string "isbn"
497
- t.integer "manifestation_id"
497
+ t.uuid "manifestation_id"
498
498
  t.integer "user_id"
499
- t.datetime "created_at"
500
- t.datetime "updated_at"
499
+ t.datetime "created_at", null: false
500
+ t.datetime "updated_at", null: false
501
501
  t.index ["isbn"], name: "index_import_requests_on_isbn", using: :btree
502
502
  t.index ["manifestation_id"], name: "index_import_requests_on_manifestation_id", using: :btree
503
503
  t.index ["user_id"], name: "index_import_requests_on_user_id", using: :btree
@@ -507,10 +507,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
507
507
  t.string "body", null: false
508
508
  t.string "isbn_type"
509
509
  t.string "source"
510
- t.integer "manifestation_id"
510
+ t.uuid "manifestation_id"
511
511
  t.datetime "created_at", null: false
512
512
  t.datetime "updated_at", null: false
513
- t.index ["body"], name: "index_isbn_records_on_body", using: :btree
513
+ t.index ["body"], name: "index_isbn_records_on_body", unique: true, using: :btree
514
514
  t.index ["manifestation_id"], name: "index_isbn_records_on_manifestation_id", using: :btree
515
515
  end
516
516
 
@@ -518,10 +518,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
518
518
  t.string "body", null: false
519
519
  t.string "issn_type"
520
520
  t.string "source"
521
- t.integer "manifestation_id"
521
+ t.uuid "manifestation_id"
522
522
  t.datetime "created_at", null: false
523
523
  t.datetime "updated_at", null: false
524
- t.index ["body"], name: "index_issn_records_on_body", using: :btree
524
+ t.index ["body"], name: "index_issn_records_on_body", unique: true, using: :btree
525
525
  t.index ["manifestation_id"], name: "index_issn_records_on_manifestation_id", using: :btree
526
526
  end
527
527
 
@@ -534,13 +534,25 @@ ActiveRecord::Schema.define(version: 20161115184756) do
534
534
  t.index ["use_restriction_id"], name: "index_item_has_use_restrictions_on_use_restriction_id", using: :btree
535
535
  end
536
536
 
537
- create_table "items", force: :cascade do |t|
537
+ create_table "item_transitions", force: :cascade do |t|
538
+ t.string "to_state", null: false
539
+ t.jsonb "metadata", default: "{}"
540
+ t.integer "sort_key", null: false
541
+ t.uuid "item_id", null: false
542
+ t.boolean "most_recent", null: false
543
+ t.datetime "created_at", null: false
544
+ t.datetime "updated_at", null: false
545
+ t.index ["item_id"], name: "index_item_transitions_on_item_id", using: :btree
546
+ t.index ["sort_key", "item_id"], name: "index_item_transitions_on_sort_key_and_item_id", unique: true, using: :btree
547
+ end
548
+
549
+ create_table "items", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
538
550
  t.string "call_number"
539
551
  t.string "item_identifier"
540
- t.datetime "created_at"
541
- t.datetime "updated_at"
552
+ t.datetime "created_at", null: false
553
+ t.datetime "updated_at", null: false
542
554
  t.datetime "deleted_at"
543
- t.integer "shelf_id", default: 1, null: false
555
+ t.integer "shelf_id", default: 1
544
556
  t.boolean "include_supplements", default: false, null: false
545
557
  t.text "note"
546
558
  t.string "url"
@@ -556,7 +568,7 @@ ActiveRecord::Schema.define(version: 20161115184756) do
556
568
  t.string "binding_item_identifier"
557
569
  t.string "binding_call_number"
558
570
  t.datetime "binded_at"
559
- t.integer "manifestation_id"
571
+ t.uuid "manifestation_id"
560
572
  t.index ["binding_item_identifier"], name: "index_items_on_binding_item_identifier", using: :btree
561
573
  t.index ["bookstore_id"], name: "index_items_on_bookstore_id", using: :btree
562
574
  t.index ["checkout_type_id"], name: "index_items_on_checkout_type_id", using: :btree
@@ -596,10 +608,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
596
608
  t.index ["item_id", "user_group_id"], name: "index_lending_policies_on_item_id_and_user_group_id", unique: true, using: :btree
597
609
  end
598
610
 
599
- create_table "libraries", force: :cascade do |t|
600
- t.string "name", null: false
601
- t.text "display_name"
602
- t.string "short_display_name", null: false
611
+ create_table "libraries", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
612
+ t.string "name", null: false
613
+ t.jsonb "display_name_translations"
614
+ t.jsonb "short_display_name_translations"
603
615
  t.string "zip_code"
604
616
  t.text "street"
605
617
  t.text "locality"
@@ -608,14 +620,14 @@ ActiveRecord::Schema.define(version: 20161115184756) do
608
620
  t.string "telephone_number_2"
609
621
  t.string "fax_number"
610
622
  t.text "note"
611
- t.integer "call_number_rows", default: 1, null: false
612
- t.string "call_number_delimiter", default: "|", null: false
613
- t.integer "library_group_id", default: 1, null: false
614
- t.integer "users_count", default: 0, null: false
623
+ t.integer "call_number_rows", default: 1, null: false
624
+ t.string "call_number_delimiter", default: "|", null: false
625
+ t.integer "library_group_id", default: 1, null: false
626
+ t.integer "users_count", default: 0, null: false
615
627
  t.integer "position"
616
628
  t.integer "country_id"
617
- t.datetime "created_at"
618
- t.datetime "updated_at"
629
+ t.datetime "created_at", null: false
630
+ t.datetime "updated_at", null: false
619
631
  t.datetime "deleted_at"
620
632
  t.text "opening_hour"
621
633
  t.string "isil"
@@ -627,19 +639,19 @@ ActiveRecord::Schema.define(version: 20161115184756) do
627
639
 
628
640
  create_table "library_groups", force: :cascade do |t|
629
641
  t.string "name", null: false
630
- t.text "display_name"
642
+ t.jsonb "display_name_translations"
631
643
  t.string "short_name", null: false
632
- t.text "my_networks"
633
- t.text "login_banner"
644
+ t.cidr "my_networks"
645
+ t.jsonb "login_banner_translations"
634
646
  t.text "note"
635
647
  t.integer "country_id"
636
648
  t.integer "position"
637
- t.datetime "created_at"
638
- t.datetime "updated_at"
639
- t.text "admin_networks"
649
+ t.datetime "created_at", null: false
650
+ t.datetime "updated_at", null: false
651
+ t.cidr "admin_networks"
640
652
  t.string "url", default: "http://localhost:3000/"
641
653
  t.jsonb "settings"
642
- t.jsonb "footer_banner"
654
+ t.jsonb "footer_banner_translations"
643
655
  t.text "html_snippet"
644
656
  t.string "book_jacket_source"
645
657
  t.integer "max_number_of_results", default: 500
@@ -647,7 +659,8 @@ ActiveRecord::Schema.define(version: 20161115184756) do
647
659
  t.string "screenshot_generator"
648
660
  t.integer "pub_year_facet_range_interval", default: 10
649
661
  t.integer "user_id"
650
- t.index ["short_name"], name: "index_library_groups_on_short_name", using: :btree
662
+ t.index ["name"], name: "index_library_groups_on_name", unique: true, using: :btree
663
+ t.index ["short_name"], name: "index_library_groups_on_short_name", unique: true, using: :btree
651
664
  t.index ["user_id"], name: "index_library_groups_on_user_id", using: :btree
652
665
  end
653
666
 
@@ -694,13 +707,14 @@ ActiveRecord::Schema.define(version: 20161115184756) do
694
707
  end
695
708
 
696
709
  create_table "manifestation_relationships", force: :cascade do |t|
697
- t.integer "parent_id"
698
- t.integer "child_id"
710
+ t.uuid "parent_id"
711
+ t.uuid "child_id"
699
712
  t.integer "manifestation_relationship_type_id"
700
- t.datetime "created_at"
701
- t.datetime "updated_at"
713
+ t.datetime "created_at", null: false
714
+ t.datetime "updated_at", null: false
702
715
  t.integer "position"
703
716
  t.index ["child_id"], name: "index_manifestation_relationships_on_child_id", using: :btree
717
+ t.index ["manifestation_relationship_type_id"], name: "index_manifestation_relationships_on_relationship_type_id", using: :btree
704
718
  t.index ["parent_id"], name: "index_manifestation_relationships_on_parent_id", using: :btree
705
719
  end
706
720
 
@@ -728,7 +742,7 @@ ActiveRecord::Schema.define(version: 20161115184756) do
728
742
  t.index ["user_id"], name: "index_manifestation_reserve_stats_on_user_id", using: :btree
729
743
  end
730
744
 
731
- create_table "manifestations", force: :cascade do |t|
745
+ create_table "manifestations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
732
746
  t.text "original_title", null: false
733
747
  t.text "title_alternative"
734
748
  t.text "title_transcription"
@@ -736,12 +750,12 @@ ActiveRecord::Schema.define(version: 20161115184756) do
736
750
  t.string "manifestation_identifier"
737
751
  t.datetime "date_of_publication"
738
752
  t.datetime "date_copyrighted"
739
- t.datetime "created_at"
740
- t.datetime "updated_at"
753
+ t.datetime "created_at", null: false
754
+ t.datetime "updated_at", null: false
741
755
  t.datetime "deleted_at"
742
756
  t.string "access_address"
743
757
  t.integer "language_id", default: 1, null: false
744
- t.integer "carrier_type_id", default: 1, null: false
758
+ t.integer "carrier_type_id", null: false
745
759
  t.integer "start_page"
746
760
  t.integer "end_page"
747
761
  t.integer "height"
@@ -792,18 +806,19 @@ ActiveRecord::Schema.define(version: 20161115184756) do
792
806
  t.jsonb "attachment_data"
793
807
  t.index ["access_address"], name: "index_manifestations_on_access_address", using: :btree
794
808
  t.index ["attachment_id"], name: "index_manifestations_on_attachment_id", using: :btree
809
+ t.index ["carrier_type_id"], name: "index_manifestations_on_carrier_type_id", using: :btree
795
810
  t.index ["date_of_publication"], name: "index_manifestations_on_date_of_publication", using: :btree
796
- t.index ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier", using: :btree
811
+ t.index ["manifestation_identifier"], name: "index_manifestations_on_manifestation_identifier", unique: true, using: :btree
797
812
  t.index ["updated_at"], name: "index_manifestations_on_updated_at", using: :btree
798
813
  end
799
814
 
800
815
  create_table "medium_of_performances", force: :cascade do |t|
801
- t.string "name", null: false
802
- t.text "display_name"
816
+ t.string "name", null: false
817
+ t.jsonb "display_name_translations"
803
818
  t.text "note"
804
819
  t.integer "position"
805
- t.datetime "created_at"
806
- t.datetime "updated_at"
820
+ t.datetime "created_at", null: false
821
+ t.datetime "updated_at", null: false
807
822
  end
808
823
 
809
824
  create_table "message_request_transitions", force: :cascade do |t|
@@ -872,10 +887,10 @@ ActiveRecord::Schema.define(version: 20161115184756) do
872
887
 
873
888
  create_table "owns", force: :cascade do |t|
874
889
  t.integer "agent_id", null: false
875
- t.integer "item_id", null: false
890
+ t.uuid "item_id", null: false
876
891
  t.integer "position"
877
- t.datetime "created_at"
878
- t.datetime "updated_at"
892
+ t.datetime "created_at", null: false
893
+ t.datetime "updated_at", null: false
879
894
  t.index ["agent_id"], name: "index_owns_on_agent_id", using: :btree
880
895
  t.index ["item_id"], name: "index_owns_on_item_id", using: :btree
881
896
  end
@@ -883,9 +898,9 @@ ActiveRecord::Schema.define(version: 20161115184756) do
883
898
  create_table "periodicals", force: :cascade do |t|
884
899
  t.text "original_title"
885
900
  t.string "periodical_type"
886
- t.integer "manifestation_id"
887
- t.datetime "created_at"
888
- t.datetime "updated_at"
901
+ t.uuid "manifestation_id"
902
+ t.datetime "created_at", null: false
903
+ t.datetime "updated_at", null: false
889
904
  t.index ["manifestation_id"], name: "index_periodicals_on_manifestation_id", using: :btree
890
905
  end
891
906
 
@@ -921,27 +936,26 @@ ActiveRecord::Schema.define(version: 20161115184756) do
921
936
 
922
937
  create_table "produces", force: :cascade do |t|
923
938
  t.integer "agent_id", null: false
924
- t.integer "manifestation_id", null: false
939
+ t.uuid "manifestation_id", null: false
925
940
  t.integer "position"
926
- t.datetime "created_at"
927
- t.datetime "updated_at"
941
+ t.datetime "created_at", null: false
942
+ t.datetime "updated_at", null: false
928
943
  t.integer "produce_type_id"
929
944
  t.index ["agent_id"], name: "index_produces_on_agent_id", using: :btree
930
945
  t.index ["manifestation_id"], name: "index_produces_on_manifestation_id", using: :btree
931
946
  end
932
947
 
933
- create_table "profiles", force: :cascade do |t|
934
- t.integer "user_id"
935
- t.integer "user_group_id"
936
- t.integer "library_id"
948
+ create_table "profiles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
949
+ t.uuid "user_group_id"
950
+ t.uuid "library_id"
937
951
  t.string "locale"
938
952
  t.string "user_number"
939
953
  t.text "full_name"
940
954
  t.text "note"
941
955
  t.text "keyword_list"
942
956
  t.integer "required_role_id"
943
- t.datetime "created_at"
944
- t.datetime "updated_at"
957
+ t.datetime "created_at", null: false
958
+ t.datetime "updated_at", null: false
945
959
  t.string "checkout_icalendar_token"
946
960
  t.boolean "save_checkout_history", default: false, null: false
947
961
  t.datetime "expired_at"
@@ -950,7 +964,6 @@ ActiveRecord::Schema.define(version: 20161115184756) do
950
964
  t.index ["checkout_icalendar_token"], name: "index_profiles_on_checkout_icalendar_token", unique: true, using: :btree
951
965
  t.index ["library_id"], name: "index_profiles_on_library_id", using: :btree
952
966
  t.index ["user_group_id"], name: "index_profiles_on_user_group_id", using: :btree
953
- t.index ["user_id"], name: "index_profiles_on_user_id", using: :btree
954
967
  t.index ["user_number"], name: "index_profiles_on_user_number", unique: true, using: :btree
955
968
  end
956
969
 
@@ -965,31 +978,33 @@ ActiveRecord::Schema.define(version: 20161115184756) do
965
978
 
966
979
  create_table "realizes", force: :cascade do |t|
967
980
  t.integer "agent_id", null: false
968
- t.integer "expression_id", null: false
981
+ t.uuid "expression_id", null: false
969
982
  t.integer "position"
970
- t.datetime "created_at"
971
- t.datetime "updated_at"
983
+ t.datetime "created_at", null: false
984
+ t.datetime "updated_at", null: false
972
985
  t.integer "realize_type_id"
973
986
  t.index ["agent_id"], name: "index_realizes_on_agent_id", using: :btree
974
987
  t.index ["expression_id"], name: "index_realizes_on_expression_id", using: :btree
975
988
  end
976
989
 
977
990
  create_table "request_status_types", force: :cascade do |t|
978
- t.string "name", null: false
979
- t.text "display_name"
991
+ t.string "name", null: false
992
+ t.jsonb "display_name_translations"
980
993
  t.text "note"
981
994
  t.integer "position"
982
- t.datetime "created_at"
983
- t.datetime "updated_at"
995
+ t.datetime "created_at", null: false
996
+ t.datetime "updated_at", null: false
997
+ t.index ["name"], name: "index_request_status_types_on_name", unique: true, using: :btree
984
998
  end
985
999
 
986
1000
  create_table "request_types", force: :cascade do |t|
987
- t.string "name", null: false
988
- t.text "display_name"
1001
+ t.string "name", null: false
1002
+ t.jsonb "display_name_translations"
989
1003
  t.text "note"
990
1004
  t.integer "position"
991
- t.datetime "created_at"
992
- t.datetime "updated_at"
1005
+ t.datetime "created_at", null: false
1006
+ t.datetime "updated_at", null: false
1007
+ t.index ["name"], name: "index_request_types_on_name", unique: true, using: :btree
993
1008
  end
994
1009
 
995
1010
  create_table "reserve_stat_has_manifestations", force: :cascade do |t|
@@ -1123,12 +1138,12 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1123
1138
  end
1124
1139
 
1125
1140
  create_table "roles", force: :cascade do |t|
1126
- t.string "name", null: false
1127
- t.string "display_name"
1141
+ t.string "name", null: false
1142
+ t.jsonb "display_name_translations"
1128
1143
  t.text "note"
1129
- t.datetime "created_at"
1130
- t.datetime "updated_at"
1131
- t.integer "score", default: 0, null: false
1144
+ t.datetime "created_at", null: false
1145
+ t.datetime "updated_at", null: false
1146
+ t.integer "score", default: 0, null: false
1132
1147
  t.integer "position"
1133
1148
  end
1134
1149
 
@@ -1186,26 +1201,26 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1186
1201
  end
1187
1202
 
1188
1203
  create_table "shelves", force: :cascade do |t|
1189
- t.string "name", null: false
1190
- t.text "display_name"
1204
+ t.string "name", null: false
1205
+ t.jsonb "display_name_translations"
1191
1206
  t.text "note"
1192
- t.integer "library_id", default: 1, null: false
1193
- t.integer "items_count", default: 0, null: false
1207
+ t.uuid "library_id", null: false
1208
+ t.integer "items_count", default: 0, null: false
1194
1209
  t.integer "position"
1195
- t.datetime "created_at"
1196
- t.datetime "updated_at"
1210
+ t.datetime "created_at", null: false
1211
+ t.datetime "updated_at", null: false
1197
1212
  t.datetime "deleted_at"
1198
- t.boolean "closed", default: false, null: false
1213
+ t.boolean "closed", default: false, null: false
1199
1214
  t.index ["library_id"], name: "index_shelves_on_library_id", using: :btree
1200
1215
  end
1201
1216
 
1202
1217
  create_table "subscribes", force: :cascade do |t|
1203
- t.integer "subscription_id", null: false
1204
- t.integer "work_id", null: false
1218
+ t.integer "subscription_id"
1219
+ t.uuid "work_id", null: false
1205
1220
  t.datetime "start_at", null: false
1206
1221
  t.datetime "end_at", null: false
1207
- t.datetime "created_at"
1208
- t.datetime "updated_at"
1222
+ t.datetime "created_at", null: false
1223
+ t.datetime "updated_at", null: false
1209
1224
  t.index ["subscription_id"], name: "index_subscribes_on_subscription_id", using: :btree
1210
1225
  t.index ["work_id"], name: "index_subscribes_on_work_id", using: :btree
1211
1226
  end
@@ -1217,8 +1232,8 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1217
1232
  t.integer "order_list_id"
1218
1233
  t.datetime "deleted_at"
1219
1234
  t.integer "subscribes_count", default: 0, null: false
1220
- t.datetime "created_at"
1221
- t.datetime "updated_at"
1235
+ t.datetime "created_at", null: false
1236
+ t.datetime "updated_at", null: false
1222
1237
  t.index ["order_list_id"], name: "index_subscriptions_on_order_list_id", using: :btree
1223
1238
  t.index ["user_id"], name: "index_subscriptions_on_user_id", using: :btree
1224
1239
  end
@@ -1266,7 +1281,6 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1266
1281
  t.boolean "most_recent"
1267
1282
  t.index ["sort_key", "user_export_file_id"], name: "index_user_export_file_transitions_on_sort_key_and_file_id", unique: true, using: :btree
1268
1283
  t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_file_id", using: :btree
1269
- t.index ["user_export_file_id"], name: "index_user_export_file_transitions_on_user_export_file_id", using: :btree
1270
1284
  end
1271
1285
 
1272
1286
  create_table "user_export_files", force: :cascade do |t|
@@ -1275,7 +1289,6 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1275
1289
  t.datetime "created_at"
1276
1290
  t.datetime "updated_at"
1277
1291
  t.jsonb "attachment_data"
1278
- t.index ["user_id"], name: "index_user_export_files_on_user_id", using: :btree
1279
1292
  end
1280
1293
 
1281
1294
  create_table "user_group_has_checkout_types", force: :cascade do |t|
@@ -1297,13 +1310,13 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1297
1310
  t.index ["user_group_id"], name: "index_user_group_has_checkout_types_on_user_group_id", using: :btree
1298
1311
  end
1299
1312
 
1300
- create_table "user_groups", force: :cascade do |t|
1313
+ create_table "user_groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
1301
1314
  t.string "name"
1302
- t.text "display_name"
1315
+ t.jsonb "display_name_translations"
1303
1316
  t.text "note"
1304
1317
  t.integer "position"
1305
- t.datetime "created_at"
1306
- t.datetime "updated_at"
1318
+ t.datetime "created_at", null: false
1319
+ t.datetime "updated_at", null: false
1307
1320
  t.datetime "deleted_at"
1308
1321
  t.integer "valid_period_for_new_user", default: 0, null: false
1309
1322
  t.datetime "expired_at"
@@ -1315,8 +1328,8 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1315
1328
  create_table "user_has_roles", force: :cascade do |t|
1316
1329
  t.integer "user_id", null: false
1317
1330
  t.integer "role_id", null: false
1318
- t.datetime "created_at"
1319
- t.datetime "updated_at"
1331
+ t.datetime "created_at", null: false
1332
+ t.datetime "updated_at", null: false
1320
1333
  t.index ["role_id"], name: "index_user_has_roles_on_role_id", using: :btree
1321
1334
  t.index ["user_id"], name: "index_user_has_roles_on_user_id", using: :btree
1322
1335
  end
@@ -1339,7 +1352,7 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1339
1352
  t.datetime "executed_at"
1340
1353
  t.string "user_import_file_name"
1341
1354
  t.string "user_import_content_type"
1342
- t.integer "user_import_file_size"
1355
+ t.string "user_import_file_size"
1343
1356
  t.datetime "user_import_updated_at"
1344
1357
  t.string "user_import_fingerprint"
1345
1358
  t.string "edit_mode"
@@ -1350,7 +1363,6 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1350
1363
  t.integer "default_library_id"
1351
1364
  t.integer "default_user_group_id"
1352
1365
  t.jsonb "attachment_data"
1353
- t.index ["user_id"], name: "index_user_import_files_on_user_id", using: :btree
1354
1366
  end
1355
1367
 
1356
1368
  create_table "user_import_results", force: :cascade do |t|
@@ -1360,8 +1372,6 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1360
1372
  t.datetime "created_at"
1361
1373
  t.datetime "updated_at"
1362
1374
  t.text "error_message"
1363
- t.index ["user_id"], name: "index_user_import_results_on_user_id", using: :btree
1364
- t.index ["user_import_file_id"], name: "index_user_import_results_on_user_import_file_id", using: :btree
1365
1375
  end
1366
1376
 
1367
1377
  create_table "user_reserve_stat_transitions", force: :cascade do |t|
@@ -1408,7 +1418,9 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1408
1418
  t.string "unlock_token"
1409
1419
  t.datetime "locked_at"
1410
1420
  t.datetime "confirmed_at"
1411
- t.index ["email"], name: "index_users_on_email", using: :btree
1421
+ t.uuid "profile_id"
1422
+ t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
1423
+ t.index ["profile_id"], name: "index_users_on_profile_id", using: :btree
1412
1424
  t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
1413
1425
  t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true, using: :btree
1414
1426
  t.index ["username"], name: "index_users_on_username", unique: true, using: :btree
@@ -1416,7 +1428,7 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1416
1428
 
1417
1429
  create_table "withdraws", force: :cascade do |t|
1418
1430
  t.integer "basket_id"
1419
- t.integer "item_id"
1431
+ t.uuid "item_id"
1420
1432
  t.integer "librarian_id"
1421
1433
  t.datetime "created_at", null: false
1422
1434
  t.datetime "updated_at", null: false
@@ -1424,14 +1436,31 @@ ActiveRecord::Schema.define(version: 20161115184756) do
1424
1436
  t.index ["item_id"], name: "index_withdraws_on_item_id", using: :btree
1425
1437
  end
1426
1438
 
1439
+ add_foreign_key "accepts", "baskets", on_delete: :nullify
1440
+ add_foreign_key "accepts", "items"
1441
+ add_foreign_key "baskets", "users"
1442
+ add_foreign_key "creates", "agents"
1443
+ add_foreign_key "doi_records", "manifestations"
1444
+ add_foreign_key "exemplifies", "items"
1445
+ add_foreign_key "exemplifies", "manifestations"
1446
+ add_foreign_key "identifiers", "manifestations"
1447
+ add_foreign_key "import_requests", "manifestations"
1448
+ add_foreign_key "import_requests", "users"
1427
1449
  add_foreign_key "isbn_records", "manifestations"
1450
+ add_foreign_key "issn_records", "manifestations"
1428
1451
  add_foreign_key "items", "manifestations"
1429
- add_foreign_key "items", "shelves"
1430
1452
  add_foreign_key "library_groups", "users"
1453
+ add_foreign_key "owns", "agents"
1454
+ add_foreign_key "owns", "items"
1431
1455
  add_foreign_key "periodicals", "manifestations"
1432
- add_foreign_key "profiles", "users"
1433
- add_foreign_key "reserves", "manifestations"
1456
+ add_foreign_key "produces", "agents"
1457
+ add_foreign_key "produces", "manifestations"
1434
1458
  add_foreign_key "shelves", "libraries"
1459
+ add_foreign_key "subscribes", "subscriptions"
1460
+ add_foreign_key "subscriptions", "users"
1435
1461
  add_foreign_key "user_has_roles", "roles"
1436
- add_foreign_key "user_has_roles", "users"
1462
+ add_foreign_key "user_has_roles", "users", on_delete: :cascade
1463
+ add_foreign_key "users", "profiles", on_delete: :cascade
1464
+ add_foreign_key "withdraws", "baskets", on_delete: :nullify
1465
+ add_foreign_key "withdraws", "items"
1437
1466
  end