jobshop 0.0.163 → 0.0.167

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -3
  3. data/Rakefile +8 -17
  4. data/app/controllers/jobshop/application_controller.rb +5 -4
  5. data/app/controllers/jobshop/places_controller.rb +0 -4
  6. data/app/controllers/jobshop/users_controller.rb +0 -3
  7. data/app/mailers/jobshop/application_mailer.rb +0 -2
  8. data/app/mailers/jobshop/rfq_responder_mailer.rb +18 -0
  9. data/app/models/jobshop/ability.rb +1 -1
  10. data/app/models/jobshop/customer.rb +30 -0
  11. data/app/models/jobshop/customer/category.rb +19 -0
  12. data/app/models/jobshop/customer/contact.rb +28 -0
  13. data/app/models/jobshop/employee.rb +46 -0
  14. data/app/models/jobshop/employment.rb +25 -0
  15. data/app/models/jobshop/employment_version.rb +10 -0
  16. data/app/models/jobshop/inspection/boolean_criterion.rb +2 -2
  17. data/app/models/jobshop/inspection/deviation_criterion.rb +4 -4
  18. data/app/models/jobshop/inspection/limit_criterion.rb +6 -4
  19. data/app/models/jobshop/inspection/report.rb +2 -0
  20. data/app/models/jobshop/inspection/result.rb +2 -2
  21. data/app/models/jobshop/mailman.rb +22 -0
  22. data/app/models/jobshop/order.rb +2 -6
  23. data/app/models/jobshop/order_line.rb +2 -3
  24. data/app/models/jobshop/organization.rb +15 -6
  25. data/app/models/jobshop/place.rb +2 -0
  26. data/app/models/jobshop/product.rb +0 -3
  27. data/app/models/jobshop/rfq.rb +12 -6
  28. data/app/models/jobshop/user.rb +2 -17
  29. data/app/views/jobshop/rfq_responder_mailer/verified_contact.html.erb +5 -0
  30. data/app/views/jobshop/rfq_responder_mailer/verified_contact.text.erb +3 -0
  31. data/app/views/layouts/jobshop/application.html.haml +15 -0
  32. data/app/views/layouts/jobshop/mailer.html.erb +13 -0
  33. data/config/initializers/devise.rb +290 -0
  34. data/config/locales/devise.en.yml +64 -0
  35. data/config/routes.rb +1 -2
  36. data/db/migrate/20170311194758_initialize_jobshop.rb +42 -2
  37. data/db/migrate/20171216021339_create_organizations.rb +1 -4
  38. data/db/migrate/20171216021400_create_employees.rb +47 -0
  39. data/db/migrate/20171216021554_create_people.rb +13 -18
  40. data/db/migrate/20171216021853_create_customers.rb +57 -0
  41. data/db/migrate/20171216022020_create_places.rb +8 -9
  42. data/db/migrate/20171216022135_create_products.rb +6 -13
  43. data/db/migrate/20171216022605_create_orders.rb +19 -36
  44. data/db/migrate/20171216023018_create_roles.rb +5 -3
  45. data/db/migrate/20171216035357_create_things.rb +4 -4
  46. data/db/migrate/20171219022118_create_routing_processes.rb +15 -15
  47. data/db/migrate/20180107203241_create_inspections.rb +15 -14
  48. data/db/migrate/20181117023949_create_rfqs.rb +27 -19
  49. data/db/migrate/20181118014603_create_mailmen.rb +6 -4
  50. data/db/seeds.rb +126 -0
  51. data/lib/generators/jobshop/app/app_generator.rb +1 -1
  52. data/lib/generators/jobshop/app/templates/Procfile.tt +1 -0
  53. data/lib/generators/jobshop/app/templates/config/database.yml.tt +5 -5
  54. data/lib/generators/jobshop/{dummy/dummy_generator.rb → canary/canary_generator.rb} +13 -14
  55. data/lib/generators/jobshop/{dummy → canary}/templates/config/boot.rb.tt +0 -0
  56. data/lib/jobshop.rb +41 -12
  57. data/lib/jobshop/cli.rb +16 -82
  58. data/lib/jobshop/cli/app_generator.rb +38 -0
  59. data/lib/jobshop/cli/application.rb +14 -0
  60. data/lib/jobshop/cli/canary.rb +52 -0
  61. data/lib/jobshop/configuration.rb +16 -11
  62. data/lib/jobshop/engine.rb +39 -28
  63. data/lib/jobshop/helpers/migration.rb +78 -2
  64. data/lib/jobshop/mailroom/base_handler.rb +33 -0
  65. data/lib/jobshop/mailroom/null_handler.rb +10 -0
  66. data/lib/jobshop/mailroom/postmaster.rb +77 -0
  67. data/lib/jobshop/mailroom/rfq_handler.rb +39 -0
  68. data/lib/jobshop/version.rb +3 -1
  69. data/lib/tasks/jobshop_tasks.rake +7 -6
  70. metadata +98 -69
  71. data/app/controllers/concerns/email_token_validation.rb +0 -59
  72. data/app/controllers/concerns/jobshop/authentication_handler.rb +0 -15
  73. data/app/controllers/concerns/jobshop/authorization_handler.rb +0 -29
  74. data/app/controllers/jobshop/session_activations_controller.rb +0 -13
  75. data/app/controllers/jobshop/sessions_controller.rb +0 -20
  76. data/app/email_handlers/jobshop/rfq_handler.rb +0 -43
  77. data/app/models/jobshop/company.rb +0 -35
  78. data/app/models/jobshop/company/type.rb +0 -17
  79. data/app/models/jobshop/company_person.rb +0 -15
  80. data/app/models/jobshop/person.rb +0 -30
  81. data/app/models/jobshop/session_activation.rb +0 -30
  82. data/app/serializers/jobshop/test_user_serializer.rb +0 -10
  83. data/app/services/jobshop/authentication_service.rb +0 -20
  84. data/app/services/jobshop/authorization_service.rb +0 -30
  85. data/app/services/jobshop/jwt_service.rb +0 -17
  86. data/db/migrate/20171216021853_create_companies.rb +0 -64
  87. data/db/migrate/20171216023022_create_sessions.rb +0 -23
  88. data/lib/jobshop/cli/spinner.rb +0 -21
  89. data/lib/jobshop/dummy_app.rb +0 -190
  90. data/lib/jobshop/postmaster.rb +0 -89
@@ -0,0 +1,64 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ email_changed:
27
+ subject: "Email Changed"
28
+ password_change:
29
+ subject: "Password Changed"
30
+ omniauth_callbacks:
31
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32
+ success: "Successfully authenticated from %{kind} account."
33
+ passwords:
34
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37
+ updated: "Your password has been changed successfully. You are now signed in."
38
+ updated_not_active: "Your password has been changed successfully."
39
+ registrations:
40
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41
+ signed_up: "Welcome! You have signed up successfully."
42
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
46
+ updated: "Your account has been updated successfully."
47
+ sessions:
48
+ signed_in: "Signed in successfully."
49
+ signed_out: "Signed out successfully."
50
+ already_signed_out: "Signed out successfully."
51
+ unlocks:
52
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55
+ errors:
56
+ messages:
57
+ already_confirmed: "was already confirmed, please try signing in"
58
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59
+ expired: "has expired, please request a new one"
60
+ not_found: "not found"
61
+ not_locked: "was not locked"
62
+ not_saved:
63
+ one: "1 error prohibited this %{resource} from being saved:"
64
+ other: "%{count} errors prohibited this %{resource} from being saved:"
data/config/routes.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  Jobshop::Engine.routes.draw do
2
- post "/signin", to: "sessions#new"
3
- get "/current-user", to: "users#current"
2
+ devise_for :users, class_name: "Jobshop::User", module: :devise
4
3
  end
@@ -2,7 +2,47 @@
2
2
 
3
3
  class InitializeJobshop < ActiveRecord::Migration[5.2]
4
4
  def change
5
- enable_extension "pgcrypto" unless extension_enabled? "pgcrypto"
6
- enable_extension "citext" unless extension_enabled? "citext"
5
+ enable_extension "pgcrypto" unless extension_enabled? "pgcrypto"
6
+ enable_extension "citext" unless extension_enabled? "citext"
7
+ enable_extension "btree_gist" unless extension_enabled? "btree_gist"
8
+
9
+ execute <<~SQL
10
+ -- prepare_auditable()
11
+ CREATE OR REPLACE FUNCTION prepare_auditable() RETURNS TRIGGER AS $$
12
+ BEGIN
13
+ IF (TG_OP = 'UPDATE') THEN
14
+ NEW.version = OLD.version + 1;
15
+ RETURN NEW;
16
+ ELSIF (TG_OP = 'INSERT') THEN
17
+ NEW.version = 0;
18
+ RETURN NEW;
19
+ END IF;
20
+ END;
21
+ $$ LANGUAGE plpgsql;
22
+
23
+ -- process_auditable(audit_table_name)
24
+ CREATE OR REPLACE FUNCTION process_auditable() RETURNS TRIGGER AS $$
25
+ DECLARE
26
+ audit_table_name text := TG_ARGV[0];
27
+
28
+ BEGIN
29
+ IF (TG_OP = 'UPDATE') THEN
30
+ EXECUTE
31
+ FORMAT(
32
+ 'INSERT INTO %1$I SELECT gen_random_uuid(), now(), ($1).*',
33
+ audit_table_name)
34
+ USING OLD;
35
+ RETURN NEW;
36
+ ELSIF (TG_OP = 'INSERT') THEN
37
+ EXECUTE
38
+ FORMAT(
39
+ 'INSERT INTO %1$I SELECT gen_random_uuid(), now(), ($1).*',
40
+ audit_table_name)
41
+ USING NEW;
42
+ RETURN NEW;
43
+ END IF;
44
+ END;
45
+ $$ LANGUAGE plpgsql;
46
+ SQL
7
47
  end
8
48
  end
@@ -11,12 +11,9 @@ class CreateOrganizations < ActiveRecord::Migration[5.2]
11
11
  t.index :organization_id, unique: true,
12
12
  name: :idx_jobshop_organizations_pkey
13
13
 
14
- t.citext :name, index: true
15
- t.index %i[ organization_id name ], unique: true
16
-
17
14
  t.timestamps
18
15
  end
19
16
 
20
- idx_table_name_pkey "jobshop_organizations"
17
+ idx_table_name_pkey :jobshop_organizations
21
18
  end
22
19
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literals: true
2
+
3
+ require "jobshop/helpers/migration.rb"
4
+
5
+ class CreateEmployees < ActiveRecord::Migration[5.2]
6
+ include Jobshop::Helpers::Migration
7
+
8
+ def change # rubocop:disable Metrics/MethodLength
9
+ create_table_with_auditing :jobshop_employees, primary_key: %i[
10
+ organization_id employee_id
11
+ ] do |t|
12
+ t.citext :email, null: false
13
+ t.string :forename
14
+ t.string :surname
15
+ t.timestamps
16
+ end
17
+
18
+ fk_organization :jobshop_employees
19
+
20
+ create_table_with_auditing :jobshop_employments, primary_key: %i[
21
+ organization_id employment_id
22
+ ] do |t|
23
+ t.uuid :employee_id
24
+ t.date :started_on, default: { expr: "('now'::text)::date" }
25
+ t.date :ended_on
26
+ t.string :title, null: false, default: ""
27
+ t.datetime :updated_at, null: false
28
+ t.uuid :updated_by_id
29
+ t.datetime :deleted_at
30
+ t.timestamps
31
+ end
32
+
33
+ fk_organization :jobshop_employments
34
+
35
+ execute <<~SQL
36
+ ALTER TABLE
37
+ jobshop_employments
38
+ ADD
39
+ CONSTRAINT no_overlapping_employments
40
+ EXCLUDE USING gist (
41
+ organization_id WITH =,
42
+ employee_id WITH =,
43
+ daterange(started_on, ended_on) WITH &&
44
+ );
45
+ SQL
46
+ end
47
+ end
@@ -2,28 +2,24 @@
2
2
 
3
3
  require "jobshop/helpers/migration.rb"
4
4
 
5
+ # TODO: Inherit employees/contacts from common people table
6
+ # TODO: This table only exists because roles still link to it. remove this once
7
+ # TODO: roles are migrated to their respective parent.
5
8
  class CreatePeople < ActiveRecord::Migration[5.2]
6
9
  include Jobshop::Helpers::Migration
7
10
 
8
11
  def change # rubocop:disable Metrics/MethodLength
9
- create_table :jobshop_people, id: false do |t|
10
- t.uuid :organization_id, null: false
11
- t.uuid :person_id, null: false, default: "gen_random_uuid()"
12
- t.index %i[ organization_id person_id ], unique: true,
13
- name: :idx_jobshop_people_pkey
14
-
12
+ create_table_with_auditing :jobshop_people, primary_key: %i[
13
+ organization_id person_id
14
+ ] do |t|
15
15
  t.citext :email, null: false
16
- t.index %i[ organization_id email ], unique: true
17
-
18
- t.string :job_title
19
16
  t.string :forename
20
17
  t.string :surname
21
-
22
18
  t.timestamps
23
19
  end
24
20
 
25
- idx_table_name_pkey :jobshop_people
26
- fk_organization_id :jobshop_people
21
+ add_index :jobshop_people, %i[ organization_id email ], unique: true
22
+ fk_organization :jobshop_people
27
23
 
28
24
  create_table :jobshop_users, id: false do |t|
29
25
  t.uuid :organization_id, null: false
@@ -31,18 +27,17 @@ class CreatePeople < ActiveRecord::Migration[5.2]
31
27
  t.index %i[ organization_id user_id ], unique: true,
32
28
  name: :idx_jobshop_users_pkey
33
29
 
34
- t.citext :email, null: false
30
+ # Database authenticatable
31
+ t.citext :email, null: false, default: ""
32
+ t.string :encrypted_password, null: false, default: ""
35
33
  t.index %i[ organization_id email ], unique: true
36
34
 
37
35
  t.string :email_authentication_token, index: { unique: true }
38
36
  t.datetime :email_authentication_token_sent_at, :datetime
39
-
40
- t.string :password_digest, null: false, default: ""
41
-
42
37
  t.timestamps
43
38
  end
44
39
 
45
- idx_table_name_pkey "jobshop_users"
46
- fk_organization_id "jobshop_users"
40
+ idx_table_name_pkey :jobshop_users
41
+ fk_organization :jobshop_users
47
42
  end
48
43
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literals: true
2
+
3
+ require "jobshop/helpers/migration.rb"
4
+
5
+ class CreateCustomers < ActiveRecord::Migration[5.2]
6
+ include Jobshop::Helpers::Migration
7
+
8
+ def change
9
+ create_table_with_auditing :jobshop_customer_categories, primary_key: %i[
10
+ organization_id category_id
11
+ ] do |t|
12
+ t.citext :name, null: false
13
+ t.text :description
14
+ end
15
+
16
+ add_index :jobshop_customer_categories, %i[ organization_id name ], unique: true
17
+
18
+ fk_organization :jobshop_customer_categories
19
+
20
+ create_table_with_auditing :jobshop_customers, primary_key: %i[
21
+ organization_id customer_id
22
+ ] do |t|
23
+ t.citext :name, null: false
24
+ t.uuid :category_id, null: false
25
+ t.string :email_from_domain
26
+ t.timestamps
27
+ end
28
+
29
+ add_index :jobshop_customers, %i[ organization_id name ], unique: true
30
+
31
+ foreign_key :jobshop_customers, :jobshop_customer_categories,
32
+ %i[ organization_id category_id ]
33
+
34
+ # Reverse index on email_from_domain allows for search on just a domain
35
+ # given the entire address.
36
+ #
37
+ # example.com will be indexed as moc.elpmaxe
38
+ add_index :jobshop_customers,
39
+ "organization_id, reverse(lower(email_from_domain)) text_pattern_ops",
40
+ name: :idx_jobshop_customers_reverse_address, unique: true
41
+
42
+ fk_organization :jobshop_customers
43
+
44
+ create_table_with_auditing :jobshop_customer_contacts, primary_key: %i[
45
+ organization_id customer_id contact_id
46
+ ] do |t|
47
+ t.citext :email, null: false
48
+ t.string :surname
49
+ t.string :forename
50
+ end
51
+
52
+ fk_organization :jobshop_customer_contacts
53
+
54
+ foreign_key :jobshop_customer_contacts, :jobshop_customers,
55
+ %i[ organization_id customer_id ]
56
+ end
57
+ end
@@ -1,22 +1,21 @@
1
+ # frozen_string_literals: true
2
+
1
3
  require "jobshop/helpers/migration.rb"
2
4
 
3
5
  class CreatePlaces < ActiveRecord::Migration[5.2]
4
6
  include Jobshop::Helpers::Migration
5
7
 
6
8
  def change
7
- create_table :jobshop_places, id: false do |t|
8
- t.uuid :organization_id, null: false
9
- t.uuid :place_id, null: false, default: "gen_random_uuid()"
10
- t.index %i[ organization_id place_id ], unique: true,
11
- name: "idx_jobshop_places_pkey"
12
-
9
+ create_table_with_auditing :jobshop_places, primary_key: %i[
10
+ organization_id place_id
11
+ ]do |t|
13
12
  t.citext :name, null: false
14
- t.index %i[ organization_id name ], unique: true
15
13
 
16
14
  t.timestamps
17
15
  end
18
16
 
19
- idx_table_name_pkey "jobshop_places"
20
- fk_organization_id "jobshop_places"
17
+ add_index :jobshop_places, %i[ organization_id name ], unique: true
18
+
19
+ fk_organization :jobshop_places
21
20
  end
22
21
  end
@@ -6,24 +6,17 @@ class CreateProducts < ActiveRecord::Migration[5.2]
6
6
  include Jobshop::Helpers::Migration
7
7
 
8
8
  def change
9
- create_table :jobshop_products, id: false do |t|
10
- t.uuid :organization_id, null: false
11
- t.uuid :product_id, null: false, default: "gen_random_uuid()"
12
- t.index %i[ organization_id product_id ], unique: true,
13
- name: "idx_jobshop_products_pkey"
14
-
15
- t.uuid :created_by_id, null: false
16
-
9
+ create_table_with_auditing :jobshop_products, primary_key: %i[
10
+ organization_id product_id
11
+ ] do |t|
17
12
  t.citext :name, null: false
18
- t.index %i[ organization_id name ], unique: true
19
-
20
13
  t.text :description
21
14
 
22
15
  t.timestamps
23
16
  end
24
17
 
25
- idx_table_name_pkey "jobshop_products"
26
- fk_organization_id "jobshop_products"
27
- fk_created_by_id "jobshop_products"
18
+ add_index :jobshop_products, %i[ organization_id name ], unique: true
19
+
20
+ fk_organization :jobshop_products
28
21
  end
29
22
  end
@@ -6,50 +6,33 @@ class CreateOrders < ActiveRecord::Migration[5.2]
6
6
  include Jobshop::Helpers::Migration
7
7
 
8
8
  def change # rubocop:disable Metrics/MethodLength
9
- create_table :jobshop_orders, id: false do |t|
10
- t.uuid :organization_id, null: false
11
- t.uuid :order_id, null: false, default: "gen_random_uuid()"
12
- t.index %i[ organization_id order_id ], unique: true,
13
- name: "idx_jobshop_orders_pkey"
14
-
15
- t.uuid :created_by_id, null: false
16
-
17
- t.uuid :company_id, null: false
18
- t.index %i[ organization_id company_id ]
19
-
9
+ create_table_with_auditing :jobshop_orders, primary_key: %i[
10
+ organization_id order_id
11
+ ] do |t|
12
+ t.uuid :customer_id, null: false
20
13
  t.string :number
21
- t.index %i[ organization_id number ], unique: true
22
-
23
14
  t.timestamps
24
15
  end
25
16
 
26
- idx_table_name_pkey "jobshop_orders"
27
- fk_organization_id "jobshop_orders"
28
- fk_created_by_id "jobshop_orders"
29
- foreign_key "jobshop_orders", "jobshop_companies",
30
- [ "organization_id", "company_id" ]
31
-
32
- create_table :jobshop_order_lines, id: false do |t|
33
- t.uuid :organization_id, null: false
34
- t.uuid :order_id, null: false
35
- t.uuid :order_line_id, null: false, default: "gen_random_uuid()"
36
- t.index %i[ organization_id order_id order_line_id ], unique: true,
37
- name: "idx_jobshop_order_lines_pkey"
38
-
39
- t.uuid :created_by_id, null: false
17
+ add_index :jobshop_orders, %i[ organization_id number ], unique: true
18
+ add_index :jobshop_orders, %i[ organization_id customer_id ],
19
+ name: :idx_jobshop_orders_organization_customer
20
+ fk_organization :jobshop_orders
21
+ foreign_key :jobshop_orders, :jobshop_customers,
22
+ %i[ organization_id customer_id ]
40
23
 
24
+ create_table_with_auditing :jobshop_order_lines, primary_key: %i[
25
+ organization_id order_id order_line_id
26
+ ] do |t|
41
27
  t.uuid :product_id, null: false
42
- t.index %i[ organization_id product_id ]
43
-
44
28
  t.timestamps
45
29
  end
46
30
 
47
- idx_table_name_pkey "jobshop_order_lines"
48
- fk_organization_id "jobshop_order_lines"
49
- fk_created_by_id "jobshop_order_lines"
50
- foreign_key "jobshop_order_lines", "jobshop_orders",
51
- [ "organization_id", "order_id" ]
52
- foreign_key "jobshop_order_lines", "jobshop_products",
53
- [ "organization_id", "product_id" ]
31
+ add_index :jobshop_order_lines, %i[ organization_id product_id ]
32
+ fk_organization :jobshop_order_lines
33
+ foreign_key :jobshop_order_lines, :jobshop_orders,
34
+ %i[ organization_id order_id ]
35
+ foreign_key :jobshop_order_lines, :jobshop_products,
36
+ %i[ organization_id product_id ]
54
37
  end
55
38
  end
@@ -19,7 +19,7 @@ class CreateRoles < ActiveRecord::Migration[5.2]
19
19
  end
20
20
 
21
21
  idx_table_name_pkey :jobshop_roles
22
- fk_organization_id :jobshop_roles
22
+ fk_organization :jobshop_roles
23
23
 
24
24
  create_table :jobshop_role_assignments, id: false do |t|
25
25
  t.uuid :organization_id, null: false
@@ -34,9 +34,11 @@ class CreateRoles < ActiveRecord::Migration[5.2]
34
34
  t.timestamps
35
35
  end
36
36
 
37
- fk_organization_id :jobshop_role_assignments
37
+ fk_organization :jobshop_role_assignments
38
+
38
39
  foreign_key :jobshop_role_assignments, :jobshop_roles,
39
40
  %i[ organization_id role_id ]
41
+
40
42
  foreign_key :jobshop_role_assignments, :jobshop_people,
41
43
  %i[ organization_id person_id ]
42
44
 
@@ -49,6 +51,6 @@ class CreateRoles < ActiveRecord::Migration[5.2]
49
51
  unique: true, name: :idx_jobshop_abilities_secondary_key
50
52
  end
51
53
 
52
- fk_organization_id :jobshop_abilities
54
+ fk_organization :jobshop_abilities
53
55
  end
54
56
  end