jobshop 0.0.157 → 0.0.163
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/email_handlers/jobshop/rfq_handler.rb +43 -0
- data/app/models/jobshop/collection.rb +6 -11
- data/app/models/jobshop/company.rb +25 -12
- data/app/models/jobshop/company/type.rb +17 -0
- data/app/models/jobshop/company_person.rb +15 -0
- data/app/models/jobshop/inspection.rb +2 -0
- data/app/models/jobshop/inspection/boolean_criterion.rb +13 -10
- data/app/models/jobshop/inspection/criterion.rb +8 -11
- data/app/models/jobshop/inspection/deviation_criterion.rb +13 -10
- data/app/models/jobshop/inspection/limit_criterion.rb +9 -7
- data/app/models/jobshop/inspection/report.rb +11 -15
- data/app/models/jobshop/inspection/result.rb +9 -5
- data/app/models/jobshop/inspection/tuple.rb +7 -3
- data/app/models/jobshop/mailman.rb +11 -0
- data/app/models/jobshop/order.rb +12 -14
- data/app/models/jobshop/order_line.rb +10 -5
- data/app/models/jobshop/organization.rb +35 -8
- data/app/models/jobshop/person.rb +30 -0
- data/app/models/jobshop/place.rb +3 -1
- data/app/models/jobshop/product.rb +10 -12
- data/app/models/jobshop/rfq.rb +22 -0
- data/app/models/jobshop/rfq_line.rb +12 -0
- data/app/models/jobshop/role.rb +6 -13
- data/app/models/jobshop/role_assignment.rb +4 -2
- data/app/models/jobshop/routing_process.rb +8 -11
- data/app/models/jobshop/routing_step.rb +4 -2
- data/app/models/jobshop/thing.rb +6 -11
- data/app/models/jobshop/user.rb +10 -17
- data/db/migrate/20170311194758_initialize_jobshop.rb +3 -1
- data/db/migrate/20171216021339_create_organizations.rb +4 -2
- data/db/migrate/20171216021554_create_people.rb +48 -0
- data/db/migrate/20171216021853_create_companies.rb +47 -8
- data/db/migrate/20171216022020_create_places.rb +3 -3
- data/db/migrate/20171216022135_create_products.rb +5 -3
- data/db/migrate/20171216022605_create_orders.rb +9 -7
- data/db/migrate/20171216023018_create_roles.rb +18 -16
- data/db/migrate/20171216023022_create_sessions.rb +9 -7
- data/db/migrate/20171216035357_create_things.rb +7 -5
- data/db/migrate/20171219022118_create_routing_processes.rb +10 -8
- data/db/migrate/{20180107203241_create_inspection.rb → 20180107203241_create_inspections.rb} +21 -16
- data/db/migrate/20181117023949_create_rfqs.rb +40 -0
- data/db/migrate/20181118014603_create_mailmen.rb +29 -0
- data/exe/jobshop +1 -1
- data/lib/generators/jobshop/app/app_generator.rb +12 -23
- data/lib/generators/jobshop/app/templates/Procfile.tt +1 -0
- data/lib/generators/jobshop/config/templates/config/initializers/jobshop.rb.tt +5 -0
- data/lib/generators/jobshop/dummy/dummy_generator.rb +4 -5
- data/lib/jobshop.rb +8 -4
- data/lib/jobshop/cli.rb +58 -47
- data/lib/jobshop/configuration.rb +17 -5
- data/lib/jobshop/dummy_app.rb +27 -15
- data/lib/jobshop/engine.rb +28 -15
- data/lib/jobshop/helpers/migration.rb +6 -2
- data/lib/jobshop/postmaster.rb +89 -0
- data/lib/jobshop/version.rb +2 -2
- data/lib/tasks/jobshop_tasks.rake +11 -0
- metadata +83 -16
- data/db/migrate/20171216021717_create_users.rb +0 -30
@@ -1,17 +1,17 @@
|
|
1
1
|
require "jobshop/helpers/migration.rb"
|
2
2
|
|
3
|
-
class CreatePlaces < ActiveRecord::Migration[5.
|
3
|
+
class CreatePlaces < ActiveRecord::Migration[5.2]
|
4
4
|
include Jobshop::Helpers::Migration
|
5
5
|
|
6
6
|
def change
|
7
7
|
create_table :jobshop_places, id: false do |t|
|
8
8
|
t.uuid :organization_id, null: false
|
9
9
|
t.uuid :place_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
10
|
+
t.index %i[ organization_id place_id ], unique: true,
|
11
11
|
name: "idx_jobshop_places_pkey"
|
12
12
|
|
13
13
|
t.citext :name, null: false
|
14
|
-
t.index [
|
14
|
+
t.index %i[ organization_id name ], unique: true
|
15
15
|
|
16
16
|
t.timestamps
|
17
17
|
end
|
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateProducts < ActiveRecord::Migration[5.
|
5
|
+
class CreateProducts < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
8
|
def change
|
7
9
|
create_table :jobshop_products, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :product_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id product_id ], unique: true,
|
11
13
|
name: "idx_jobshop_products_pkey"
|
12
14
|
|
13
15
|
t.uuid :created_by_id, null: false
|
14
16
|
|
15
17
|
t.citext :name, null: false
|
16
|
-
t.index [
|
18
|
+
t.index %i[ organization_id name ], unique: true
|
17
19
|
|
18
20
|
t.text :description
|
19
21
|
|
@@ -1,22 +1,24 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateOrders < ActiveRecord::Migration[5.
|
5
|
+
class CreateOrders < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
|
-
def change
|
8
|
+
def change # rubocop:disable Metrics/MethodLength
|
7
9
|
create_table :jobshop_orders, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :order_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id order_id ], unique: true,
|
11
13
|
name: "idx_jobshop_orders_pkey"
|
12
14
|
|
13
15
|
t.uuid :created_by_id, null: false
|
14
16
|
|
15
17
|
t.uuid :company_id, null: false
|
16
|
-
t.index [
|
18
|
+
t.index %i[ organization_id company_id ]
|
17
19
|
|
18
20
|
t.string :number
|
19
|
-
t.index [
|
21
|
+
t.index %i[ organization_id number ], unique: true
|
20
22
|
|
21
23
|
t.timestamps
|
22
24
|
end
|
@@ -31,13 +33,13 @@ class CreateOrders < ActiveRecord::Migration[5.1]
|
|
31
33
|
t.uuid :organization_id, null: false
|
32
34
|
t.uuid :order_id, null: false
|
33
35
|
t.uuid :order_line_id, null: false, default: "gen_random_uuid()"
|
34
|
-
t.index [
|
36
|
+
t.index %i[ organization_id order_id order_line_id ], unique: true,
|
35
37
|
name: "idx_jobshop_order_lines_pkey"
|
36
38
|
|
37
39
|
t.uuid :created_by_id, null: false
|
38
40
|
|
39
41
|
t.uuid :product_id, null: false
|
40
|
-
t.index [
|
42
|
+
t.index %i[ organization_id product_id ]
|
41
43
|
|
42
44
|
t.timestamps
|
43
45
|
end
|
@@ -1,52 +1,54 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateRoles < ActiveRecord::Migration[5.
|
5
|
+
class CreateRoles < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
|
-
def change
|
8
|
+
def change # rubocop:disable Metrics/MethodLength
|
7
9
|
create_table :jobshop_roles, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :role_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id role_id ], unique: true,
|
11
13
|
name: :idx_jobshop_roles_pkey
|
12
14
|
|
13
15
|
t.citext :name
|
14
|
-
t.index [
|
16
|
+
t.index %i[ organization_id name ], unique: true
|
15
17
|
|
16
18
|
t.timestamps
|
17
19
|
end
|
18
20
|
|
19
|
-
idx_table_name_pkey
|
20
|
-
fk_organization_id
|
21
|
+
idx_table_name_pkey :jobshop_roles
|
22
|
+
fk_organization_id :jobshop_roles
|
21
23
|
|
22
24
|
create_table :jobshop_role_assignments, id: false do |t|
|
23
25
|
t.uuid :organization_id, null: false
|
24
|
-
t.uuid :
|
26
|
+
t.uuid :person_id, null: false
|
25
27
|
t.uuid :role_id, null: false
|
26
28
|
|
27
|
-
t.index [
|
29
|
+
t.index %i[ organization_id person_id role_id ], unique: true,
|
28
30
|
name: :jobshop_role_assignment_user_roles_ckey
|
29
|
-
t.index [
|
31
|
+
t.index %i[ organization_id role_id person_id ], unique: true,
|
30
32
|
name: :jobshop_role_assignment_role_users_ckey
|
31
33
|
|
32
34
|
t.timestamps
|
33
35
|
end
|
34
36
|
|
35
|
-
fk_organization_id
|
36
|
-
foreign_key
|
37
|
-
[
|
38
|
-
foreign_key
|
39
|
-
[
|
37
|
+
fk_organization_id :jobshop_role_assignments
|
38
|
+
foreign_key :jobshop_role_assignments, :jobshop_roles,
|
39
|
+
%i[ organization_id role_id ]
|
40
|
+
foreign_key :jobshop_role_assignments, :jobshop_people,
|
41
|
+
%i[ organization_id person_id ]
|
40
42
|
|
41
43
|
create_table :jobshop_abilities, id: :uuid, default: "gen_random_uuid()" do |t|
|
42
44
|
t.uuid :organization_id, null: false
|
43
45
|
t.uuid :resource_id
|
44
46
|
t.string :resource_class, null: false
|
45
47
|
t.integer :action
|
46
|
-
t.index [
|
48
|
+
t.index %i[ organization_id resource_class action resource_id ],
|
47
49
|
unique: true, name: :idx_jobshop_abilities_secondary_key
|
48
50
|
end
|
49
51
|
|
50
|
-
fk_organization_id
|
52
|
+
fk_organization_id :jobshop_abilities
|
51
53
|
end
|
52
54
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateSessions < ActiveRecord::Migration[5.
|
5
|
+
class CreateSessions < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
8
|
def change
|
@@ -8,14 +10,14 @@ class CreateSessions < ActiveRecord::Migration[5.1]
|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :user_id, null: false
|
10
12
|
t.string :activation_token, null: false, activation_token: { unique: true }
|
11
|
-
t.index [
|
12
|
-
name:
|
13
|
+
t.index %i[ organization_id user_id activation_token ], unique: true,
|
14
|
+
name: :idx_jobshop_sessions_pkey
|
13
15
|
t.timestamps
|
14
16
|
end
|
15
17
|
|
16
|
-
idx_table_name_pkey
|
17
|
-
fk_organization_id
|
18
|
-
foreign_key
|
19
|
-
[
|
18
|
+
idx_table_name_pkey :jobshop_sessions
|
19
|
+
fk_organization_id :jobshop_sessions
|
20
|
+
foreign_key :jobshop_sessions, :jobshop_users,
|
21
|
+
%i[ organization_id user_id ]
|
20
22
|
end
|
21
23
|
end
|
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateThings < ActiveRecord::Migration[5.
|
5
|
+
class CreateThings < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
8
|
def change
|
7
9
|
create_table :jobshop_things, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :thing_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id thing_id ],
|
11
13
|
name: :idx_jobshop_things_pkey, unique: true
|
12
14
|
|
13
15
|
t.uuid :collection_id, null: false
|
14
16
|
t.citext :name
|
15
|
-
t.index [
|
17
|
+
t.index %i[ organization_id collection_id name ], unique: true,
|
16
18
|
name: :idx_jobshop_organization_id_collection_id_name
|
17
19
|
|
18
20
|
t.jsonb :custom_fields, null: false, default: "{}"
|
@@ -27,11 +29,11 @@ class CreateThings < ActiveRecord::Migration[5.1]
|
|
27
29
|
create_table :jobshop_collections, id: false do |t|
|
28
30
|
t.uuid :organization_id, null: false
|
29
31
|
t.uuid :collection_id, null: false, default: "gen_random_uuid()"
|
30
|
-
t.index [
|
32
|
+
t.index %i[ organization_id collection_id ], unique: true,
|
31
33
|
name: :idx_jobshop_collections_pkey
|
32
34
|
|
33
35
|
t.citext :name
|
34
|
-
t.index [
|
36
|
+
t.index %i[ organization_id name ], unique: true
|
35
37
|
|
36
38
|
t.jsonb :schema, null: false, default: "{}"
|
37
39
|
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class CreateRoutingProcesses < ActiveRecord::Migration[5.
|
5
|
+
class CreateRoutingProcesses < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
|
-
def change
|
8
|
+
def change # rubocop:disable Metrics/MethodLength
|
7
9
|
create_table :jobshop_routing_processes, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :routing_process_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id routing_process_id ], unique: true,
|
11
13
|
name: "idx_jobshop_routing_processes_pkey"
|
12
14
|
|
13
15
|
t.uuid :product_id
|
14
|
-
t.index [
|
16
|
+
t.index %i[ organization_id product_id ], unique: true,
|
15
17
|
name: "idx_jobshop_routing_processes_product_id"
|
16
18
|
end
|
17
19
|
|
@@ -24,7 +26,7 @@ class CreateRoutingProcesses < ActiveRecord::Migration[5.1]
|
|
24
26
|
t.uuid :organization_id, null: false
|
25
27
|
t.uuid :routing_process_id, null: false
|
26
28
|
t.uuid :routing_process_instance_id, null: false, default: "gen_random_uuid()"
|
27
|
-
t.index [
|
29
|
+
t.index %i[ organization_id routing_process_id routing_process_instance_id ], unique: true,
|
28
30
|
name: "idx_jobshop_routing_process_instances_pkey"
|
29
31
|
|
30
32
|
t.timestamps
|
@@ -36,15 +38,15 @@ class CreateRoutingProcesses < ActiveRecord::Migration[5.1]
|
|
36
38
|
create_table :jobshop_routing_steps, id: false do |t|
|
37
39
|
t.uuid :organization_id, null: false
|
38
40
|
t.uuid :routing_step_id, null: false, default: "gen_random_uuid()"
|
39
|
-
t.index [
|
41
|
+
t.index %i[ organization_id routing_step_id ], unique: true,
|
40
42
|
name: "idx_jobshop_routing_steps_pkey"
|
41
43
|
|
42
44
|
t.uuid :routing_process_id, null: false
|
43
|
-
t.index [
|
45
|
+
t.index %i[ organization_id routing_process_id ],
|
44
46
|
name: "idx_jobshop_routing_steps_routing_process_id"
|
45
47
|
|
46
48
|
t.citext :name
|
47
|
-
t.index [
|
49
|
+
t.index %i[ organization_id name ]
|
48
50
|
end
|
49
51
|
|
50
52
|
idx_table_name_pkey "jobshop_routing_steps"
|
data/db/migrate/{20180107203241_create_inspection.rb → 20180107203241_create_inspections.rb}
RENAMED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
|
1
3
|
require "jobshop/helpers/migration.rb"
|
2
4
|
|
3
|
-
class
|
5
|
+
class CreateInspections < ActiveRecord::Migration[5.2]
|
4
6
|
include Jobshop::Helpers::Migration
|
5
7
|
|
6
|
-
def change
|
8
|
+
def change # rubocop:disable Metrics/MethodLength
|
7
9
|
create_table :jobshop_inspection_reports, id: false do |t|
|
8
10
|
t.uuid :organization_id, null: false
|
9
11
|
t.uuid :report_id, null: false, default: "gen_random_uuid()"
|
10
|
-
t.index [
|
12
|
+
t.index %i[ organization_id report_id ], unique: true,
|
11
13
|
name: "idx_jobshop_inspection_reports_pkey"
|
12
14
|
|
13
15
|
t.timestamps
|
@@ -21,16 +23,19 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
21
23
|
t.uuid :report_id, null: false
|
22
24
|
t.uuid :criterion_id, null: false, default: "gen_random_uuid()"
|
23
25
|
t.string :criterion_type, null: false
|
24
|
-
t.index [
|
26
|
+
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
25
27
|
name: "idx_jobshop_inspection_criteria_pkey", unique: true
|
28
|
+
|
26
29
|
t.integer :position, null: false
|
27
|
-
t.index [
|
30
|
+
t.index %i[ report_id position ], unique: true
|
28
31
|
|
29
32
|
t.citext :name, null: false
|
30
|
-
t.index [
|
33
|
+
t.index %i[ report_id name ], unique: true,
|
31
34
|
name: "idx_jobshop_inspection_criteria_name"
|
32
35
|
end
|
33
36
|
|
37
|
+
# At what point do Jobshop::Inspection::Criteria::Types
|
38
|
+
# become their own relation?
|
34
39
|
execute <<~SQL
|
35
40
|
ALTER TABLE jobshop_inspection_criteria
|
36
41
|
ADD CONSTRAINT valid_criterion_type
|
@@ -48,7 +53,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
48
53
|
t.uuid :organization_id, null: false
|
49
54
|
t.uuid :report_id, null: false
|
50
55
|
t.integer :position, null: false
|
51
|
-
t.index [
|
56
|
+
t.index %i[ organization_id report_id position ], unique: true,
|
52
57
|
name: "idx_jobshop_inspection_tuples_pkey"
|
53
58
|
end
|
54
59
|
|
@@ -61,7 +66,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
61
66
|
t.uuid :criterion_id, null: false
|
62
67
|
t.string :criterion_type, null: false
|
63
68
|
t.integer :position, null: false
|
64
|
-
t.index [
|
69
|
+
t.index %i[ organization_id report_id criterion_id criterion_type position ],
|
65
70
|
name: "idx_jobshop_inspection_results_pkey", unique: true
|
66
71
|
|
67
72
|
t.decimal :value
|
@@ -71,10 +76,10 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
71
76
|
idx_table_name_pkey :jobshop_inspection_results
|
72
77
|
fk_organization_id :jobshop_inspection_results
|
73
78
|
foreign_key :jobshop_inspection_results, :jobshop_inspection_criteria,
|
74
|
-
[
|
79
|
+
%i[ organization_id report_id criterion_id criterion_type ],
|
75
80
|
"DEFERRABLE INITIALLY DEFERRED"
|
76
81
|
foreign_key :jobshop_inspection_results, :jobshop_inspection_tuples,
|
77
|
-
[
|
82
|
+
%i[ organization_id report_id position ],
|
78
83
|
"DEFERRABLE INITIALLY DEFERRED"
|
79
84
|
|
80
85
|
create_table :jobshop_inspection_boolean_criteria, id: false do |t|
|
@@ -82,7 +87,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
82
87
|
t.uuid :report_id, null: false
|
83
88
|
t.uuid :criterion_id, null: false
|
84
89
|
t.string :criterion_type, null: false, default: "Jobshop::Inspection::BooleanCriterion"
|
85
|
-
t.index [
|
90
|
+
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
86
91
|
name: "idx_jobshop_inspection_boolean_criteria_pkey", unique: true
|
87
92
|
|
88
93
|
t.citext :condition
|
@@ -98,7 +103,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
98
103
|
fk_organization_id :jobshop_inspection_boolean_criteria
|
99
104
|
foreign_key :jobshop_inspection_boolean_criteria,
|
100
105
|
:jobshop_inspection_criteria,
|
101
|
-
[
|
106
|
+
%i[ organization_id report_id criterion_id criterion_type ],
|
102
107
|
"DEFERRABLE INITIALLY DEFERRED"
|
103
108
|
|
104
109
|
create_table :jobshop_inspection_limit_criteria, id: false do |t|
|
@@ -106,7 +111,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
106
111
|
t.uuid :report_id, null: false
|
107
112
|
t.uuid :criterion_id, null: false
|
108
113
|
t.string :criterion_type, null: false, default: "Jobshop::Inspection::LimitCriterion"
|
109
|
-
t.index [
|
114
|
+
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
110
115
|
name: "idx_jobshop_inspection_limit_criteria_pkey", unique: true
|
111
116
|
|
112
117
|
t.decimal :minimum
|
@@ -125,7 +130,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
125
130
|
fk_organization_id :jobshop_inspection_limit_criteria
|
126
131
|
foreign_key :jobshop_inspection_limit_criteria,
|
127
132
|
:jobshop_inspection_criteria,
|
128
|
-
[
|
133
|
+
%i[ organization_id report_id criterion_id criterion_type ],
|
129
134
|
"DEFERRABLE INITIALLY DEFERRED"
|
130
135
|
|
131
136
|
create_table :jobshop_inspection_deviation_criteria, id: false do |t|
|
@@ -133,7 +138,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
133
138
|
t.uuid :report_id, null: false
|
134
139
|
t.uuid :criterion_id, null: false
|
135
140
|
t.string :criterion_type, null: false, default: "Jobshop::Inspection::DeviationCriterion"
|
136
|
-
t.index [
|
141
|
+
t.index %i[ organization_id report_id criterion_id criterion_type ],
|
137
142
|
name: "idx_jobshop_inspection_deviation_criteria_pkey", unique: true
|
138
143
|
|
139
144
|
t.decimal :nominal, null: false
|
@@ -153,7 +158,7 @@ class CreateInspection < ActiveRecord::Migration[5.1]
|
|
153
158
|
fk_organization_id :jobshop_inspection_deviation_criteria
|
154
159
|
foreign_key :jobshop_inspection_deviation_criteria,
|
155
160
|
:jobshop_inspection_criteria,
|
156
|
-
[
|
161
|
+
%i[ organization_id report_id criterion_id criterion_type ],
|
157
162
|
"DEFERRABLE INITIALLY DEFERRED"
|
158
163
|
end
|
159
164
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "jobshop/helpers/migration.rb"
|
2
|
+
|
3
|
+
class CreateRFQs < ActiveRecord::Migration[5.2]
|
4
|
+
include Jobshop::Helpers::Migration
|
5
|
+
|
6
|
+
def change
|
7
|
+
create_table :jobshop_rfqs, id: false do |t|
|
8
|
+
t.uuid :organization_id, null: false
|
9
|
+
t.uuid :rfq_id, null: false, default: "gen_random_uuid()"
|
10
|
+
t.index %i[ organization_id rfq_id ], unique: true,
|
11
|
+
name: "idx_jobshop_rfqs_pkey"
|
12
|
+
|
13
|
+
t.uuid :company_id, null: true
|
14
|
+
t.index %i[ organization_id company_id ], where: "company_id IS NOT NULL"
|
15
|
+
t.index %i[ organization_id company_id ], where: "company_id IS NULL",
|
16
|
+
name: "idx_jobshop_rfqs_company_is_null"
|
17
|
+
|
18
|
+
t.string :from
|
19
|
+
t.string :subject, null: false
|
20
|
+
t.text :content, null: false
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
idx_table_name_pkey "jobshop_rfqs"
|
26
|
+
fk_organization_id "jobshop_rfqs"
|
27
|
+
foreign_key "jobshop_rfqs", "jobshop_companies",
|
28
|
+
[ "organization_id", "company_id" ]
|
29
|
+
|
30
|
+
create_table :jobshop_rfq_lines, id: false do |t|
|
31
|
+
t.uuid :organization_id, null: false
|
32
|
+
t.uuid :rfq_id, null: false
|
33
|
+
t.uuid :rfq_line_id, null: false, default: "gen_random_uuid()"
|
34
|
+
t.index %i[ organization_id rfq_id rfq_line_id ], unique: true,
|
35
|
+
name: "idx_jobshop_rfq_lines_pkey"
|
36
|
+
|
37
|
+
t.timestamps
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|