activefacts-examples 1.9.8 → 1.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/activefacts-examples.gemspec +2 -2
- data/cql/CinemaBookings.cql +7 -1
- data/cql/CinemaTickets.cql +6 -3
- data/cql/CompanyDirectorEmployee.cql +1 -1
- data/cql/Diplomacy.cql +2 -2
- data/cql/OilSupply.cql +3 -3
- data/cql/OneRoleNesting.cql +1 -1
- data/cql/SeparateSubtype.cql +6 -0
- data/cql/ServiceDirector.cql +13 -13
- data/cql/Supervision.cql +2 -3
- data/cql/Warehousing.cql +4 -4
- data/diagrams/json/CinemaTickets.json +7 -4
- data/diagrams/json/OilSupply.json +4 -4
- data/diagrams/json/OneRoleNesting.json +1 -1
- data/images/CinemaTickets.png +0 -0
- data/images/MultipleSubtyping.png +0 -0
- data/images/OilSupply.png +0 -0
- data/metadata/json/CinemaTickets.json +141 -149
- data/metadata/json/Metamodel.json +747 -466
- data/metadata/json/OilSupply.json +63 -63
- data/orm/Blog.orm +214 -214
- data/orm/CinemaTickets.orm +931 -962
- data/orm/ExampleModels2010.csproj +33 -0
- data/orm/MultipleSubtyping.orm +110 -9
- data/orm/OilSupply.orm +347 -353
- data/orm/Warehousing.orm +34 -22
- data/rails/models/CinemaTickets.models +5 -7
- data/rails/schema/Astronomy.schema.rb +14 -14
- data/rails/schema/CinemaBookings.schema.rb +49 -49
- data/rails/schema/CinemaTickets.schema.rb +97 -97
- data/rails/schema/Diplomacy.schema.rb +48 -48
- data/rails/schema/Metamodel.schema.rb +497 -497
- data/rails/schema/SeparateSubtype.schema.rb +18 -18
- data/rails/schema/VenueSeating.schema.rb +26 -26
- data/rails/schema/Warehousing.schema.rb +101 -101
- data/ruby/CinemaTickets.rb +7 -11
- data/ruby/OilSupply.rb +3 -3
- data/ruby/OneRoleNesting.rb +1 -1
- data/sql/server/CinemaTickets.sql +13 -13
- data/sql/server/OilSupply.sql +3 -3
- data/sql/server/OneRoleNesting.sql +6 -6
- metadata +8 -7
@@ -1,35 +1,35 @@
|
|
1
1
|
#
|
2
|
-
# schema.rb auto-generated using ActiveFacts for SeparateSubtype on
|
2
|
+
# schema.rb auto-generated using ActiveFacts for SeparateSubtype on 2016-06-23
|
3
3
|
#
|
4
4
|
|
5
5
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
6
|
-
ActiveRecord::Schema.define(:
|
6
|
+
ActiveRecord::Schema.define(version: 20160623164302) do
|
7
7
|
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
|
8
|
-
create_table "claims", :
|
9
|
-
t.column "claim_id", :primary_key, :
|
10
|
-
t.column "incident_date_time", :datetime, :
|
11
|
-
t.column "incident_witness_id", :integer, :
|
8
|
+
create_table "claims", id: false, force: true do |t|
|
9
|
+
t.column "claim_id", :primary_key, null: false
|
10
|
+
t.column "incident_date_time", :datetime, null: true
|
11
|
+
t.column "incident_witness_id", :integer, null: true
|
12
12
|
end
|
13
13
|
|
14
14
|
|
15
|
-
create_table "people", :
|
16
|
-
t.column "person_id", :primary_key, :
|
17
|
-
t.column "person_name", :string, :
|
15
|
+
create_table "people", id: false, force: true do |t|
|
16
|
+
t.column "person_id", :primary_key, null: false
|
17
|
+
t.column "person_name", :string, null: false
|
18
18
|
end
|
19
19
|
|
20
|
-
add_index "people", ["person_name"], :
|
20
|
+
add_index "people", ["person_name"], name: :index_people_on_person_name, unique: true
|
21
21
|
|
22
|
-
create_table "vehicle_incidents", :
|
23
|
-
t.column "incident_claim_id", :primary_key, :
|
24
|
-
t.column "driver_id", :integer, :
|
22
|
+
create_table "vehicle_incidents", id: false, force: true do |t|
|
23
|
+
t.column "incident_claim_id", :primary_key, null: false
|
24
|
+
t.column "driver_id", :integer, null: true
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
28
|
unless ENV["EXCLUDE_FKS"]
|
29
|
-
add_foreign_key :claims, :people, :
|
30
|
-
add_index :claims, [:incident_witness_id], :
|
31
|
-
add_foreign_key :vehicle_incidents, :claims, :
|
32
|
-
add_foreign_key :vehicle_incidents, :people, :
|
33
|
-
add_index :vehicle_incidents, [:driver_id], :
|
29
|
+
add_foreign_key :claims, :people, column: :incident_witness_id, primary_key: :person_id, on_delete: :cascade
|
30
|
+
add_index :claims, [:incident_witness_id], unique: false, name: :index_claims_on_incident_witness_id
|
31
|
+
add_foreign_key :vehicle_incidents, :claims, column: :incident_claim_id, primary_key: :claim_id, on_delete: :cascade
|
32
|
+
add_foreign_key :vehicle_incidents, :people, column: :driver_id, primary_key: :person_id, on_delete: :cascade
|
33
|
+
add_index :vehicle_incidents, [:driver_id], unique: false, name: :index_vehicle_incidents_on_driver_id
|
34
34
|
end
|
35
35
|
end
|
@@ -1,46 +1,46 @@
|
|
1
1
|
#
|
2
|
-
# schema.rb auto-generated using ActiveFacts for VenueSeating on
|
2
|
+
# schema.rb auto-generated using ActiveFacts for VenueSeating on 2016-06-23
|
3
3
|
#
|
4
4
|
|
5
5
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
6
|
-
ActiveRecord::Schema.define(:
|
6
|
+
ActiveRecord::Schema.define(version: 20160623164308) do
|
7
7
|
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
|
8
|
-
create_table "events", :
|
9
|
-
t.column "event_id", :primary_key, :
|
10
|
-
t.column "venue_id", :integer, :
|
8
|
+
create_table "events", id: false, force: true do |t|
|
9
|
+
t.column "event_id", :primary_key, null: false
|
10
|
+
t.column "venue_id", :integer, null: false
|
11
11
|
end
|
12
12
|
|
13
13
|
|
14
|
-
create_table "seats", :
|
15
|
-
t.column "seat_id", :primary_key, :
|
16
|
-
t.column "venue_id", :integer, :
|
17
|
-
t.column "number", :integer, :
|
18
|
-
t.column "reserve_name", :string, :
|
19
|
-
t.column "row_code", :string, :
|
14
|
+
create_table "seats", id: false, force: true do |t|
|
15
|
+
t.column "seat_id", :primary_key, null: false
|
16
|
+
t.column "venue_id", :integer, null: false
|
17
|
+
t.column "number", :integer, limit: 16, null: false
|
18
|
+
t.column "reserve_name", :string, null: false
|
19
|
+
t.column "row_code", :string, null: false
|
20
20
|
end
|
21
21
|
|
22
|
-
add_index "seats", ["venue_id", "reserve_name", "row_code", "number"], :
|
22
|
+
add_index "seats", ["venue_id", "reserve_name", "row_code", "number"], name: :index_seats_on_venue_id_reserve_name_row_code_number, unique: true
|
23
23
|
|
24
|
-
create_table "tickets", :
|
25
|
-
t.column "event_id", :integer, :
|
26
|
-
t.column "seat_id", :integer, :
|
24
|
+
create_table "tickets", id: false, force: true do |t|
|
25
|
+
t.column "event_id", :integer, null: false
|
26
|
+
t.column "seat_id", :integer, null: false
|
27
27
|
end
|
28
28
|
|
29
|
-
add_index "tickets", ["event_id", "seat_id"], :
|
29
|
+
add_index "tickets", ["event_id", "seat_id"], name: :index_tickets_on_event_id_seat_id, unique: true
|
30
30
|
|
31
|
-
create_table "venues", :
|
32
|
-
t.column "venue_id", :primary_key, :
|
31
|
+
create_table "venues", id: false, force: true do |t|
|
32
|
+
t.column "venue_id", :primary_key, null: false
|
33
33
|
end
|
34
34
|
|
35
35
|
|
36
36
|
unless ENV["EXCLUDE_FKS"]
|
37
|
-
add_foreign_key :events, :venues, :
|
38
|
-
add_index :events, [:venue_id], :
|
39
|
-
add_foreign_key :seats, :venues, :
|
40
|
-
add_index :seats, [:venue_id], :
|
41
|
-
add_foreign_key :tickets, :events, :
|
42
|
-
add_index :tickets, [:event_id], :
|
43
|
-
add_foreign_key :tickets, :seats, :
|
44
|
-
add_index :tickets, [:seat_id], :
|
37
|
+
add_foreign_key :events, :venues, column: :venue_id, primary_key: :venue_id, on_delete: :cascade
|
38
|
+
add_index :events, [:venue_id], unique: false, name: :index_events_on_venue_id
|
39
|
+
add_foreign_key :seats, :venues, column: :venue_id, primary_key: :venue_id, on_delete: :cascade
|
40
|
+
add_index :seats, [:venue_id], unique: false, name: :index_seats_on_venue_id
|
41
|
+
add_foreign_key :tickets, :events, column: :event_id, primary_key: :event_id, on_delete: :cascade
|
42
|
+
add_index :tickets, [:event_id], unique: false, name: :index_tickets_on_event_id
|
43
|
+
add_foreign_key :tickets, :seats, column: :seat_id, primary_key: :seat_id, on_delete: :cascade
|
44
|
+
add_index :tickets, [:seat_id], unique: false, name: :index_tickets_on_seat_id
|
45
45
|
end
|
46
46
|
end
|
@@ -1,145 +1,145 @@
|
|
1
1
|
#
|
2
|
-
# schema.rb auto-generated using ActiveFacts for Warehousing on
|
2
|
+
# schema.rb auto-generated using ActiveFacts for Warehousing on 2016-06-23
|
3
3
|
#
|
4
4
|
|
5
5
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
6
|
-
ActiveRecord::Schema.define(:
|
6
|
+
ActiveRecord::Schema.define(version: 20160623164308) do
|
7
7
|
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
|
8
|
-
create_table "back_order_allocations", :
|
9
|
-
t.column "back_order_allocation_id", :primary_key, :
|
10
|
-
t.column "purchase_order_item_id", :integer, :
|
11
|
-
t.column "sales_order_item_id", :integer, :
|
12
|
-
t.column "quantity", :integer, :
|
8
|
+
create_table "back_order_allocations", id: false, force: true do |t|
|
9
|
+
t.column "back_order_allocation_id", :primary_key, null: false
|
10
|
+
t.column "purchase_order_item_id", :integer, null: false
|
11
|
+
t.column "sales_order_item_id", :integer, null: false
|
12
|
+
t.column "quantity", :integer, limit: 32, null: false
|
13
13
|
end
|
14
14
|
|
15
|
-
add_index "back_order_allocations", ["purchase_order_item_id", "sales_order_item_id"], :
|
15
|
+
add_index "back_order_allocations", ["purchase_order_item_id", "sales_order_item_id"], name: :index_back_order_allocations_on_purchase_order_item_i__1a63f970, unique: true
|
16
16
|
|
17
|
-
create_table "bins", :
|
18
|
-
t.column "bin_id", :primary_key, :
|
19
|
-
t.column "product_id", :integer, :
|
20
|
-
t.column "warehouse_id", :integer, :
|
21
|
-
t.column "quantity", :integer, :
|
17
|
+
create_table "bins", id: false, force: true do |t|
|
18
|
+
t.column "bin_id", :primary_key, null: false
|
19
|
+
t.column "product_id", :integer, null: true
|
20
|
+
t.column "warehouse_id", :integer, null: true
|
21
|
+
t.column "quantity", :integer, limit: 32, null: false
|
22
22
|
end
|
23
23
|
|
24
24
|
|
25
|
-
create_table "dispatch_items", :
|
26
|
-
t.column "dispatch_item_id", :primary_key, :
|
27
|
-
t.column "product_id", :integer, :
|
28
|
-
t.column "sales_order_item_id", :integer, :
|
29
|
-
t.column "transfer_request_id", :integer, :
|
30
|
-
t.column "dispatch_id", :integer, :
|
31
|
-
t.column "quantity", :integer, :
|
25
|
+
create_table "dispatch_items", id: false, force: true do |t|
|
26
|
+
t.column "dispatch_item_id", :primary_key, null: false
|
27
|
+
t.column "product_id", :integer, null: false
|
28
|
+
t.column "sales_order_item_id", :integer, null: true
|
29
|
+
t.column "transfer_request_id", :integer, null: true
|
30
|
+
t.column "dispatch_id", :integer, null: true
|
31
|
+
t.column "quantity", :integer, limit: 32, null: false
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
|
-
create_table "parties", :
|
36
|
-
t.column "party_id", :primary_key, :
|
35
|
+
create_table "parties", id: false, force: true do |t|
|
36
|
+
t.column "party_id", :primary_key, null: false
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
|
-
create_table "products", :
|
41
|
-
t.column "product_id", :primary_key, :
|
40
|
+
create_table "products", id: false, force: true do |t|
|
41
|
+
t.column "product_id", :primary_key, null: false
|
42
42
|
end
|
43
43
|
|
44
44
|
|
45
|
-
create_table "purchase_orders", :
|
46
|
-
t.column "purchase_order_id", :primary_key, :
|
47
|
-
t.column "supplier_id", :integer, :
|
48
|
-
t.column "warehouse_id", :integer, :
|
45
|
+
create_table "purchase_orders", id: false, force: true do |t|
|
46
|
+
t.column "purchase_order_id", :primary_key, null: false
|
47
|
+
t.column "supplier_id", :integer, null: false
|
48
|
+
t.column "warehouse_id", :integer, null: false
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
|
-
create_table "purchase_order_items", :
|
53
|
-
t.column "purchase_order_item_id", :primary_key, :
|
54
|
-
t.column "product_id", :integer, :
|
55
|
-
t.column "purchase_order_id", :integer, :
|
56
|
-
t.column "quantity", :integer, :
|
52
|
+
create_table "purchase_order_items", id: false, force: true do |t|
|
53
|
+
t.column "purchase_order_item_id", :primary_key, null: false
|
54
|
+
t.column "product_id", :integer, null: false
|
55
|
+
t.column "purchase_order_id", :integer, null: false
|
56
|
+
t.column "quantity", :integer, limit: 32, null: false
|
57
57
|
end
|
58
58
|
|
59
|
-
add_index "purchase_order_items", ["purchase_order_id", "product_id"], :
|
59
|
+
add_index "purchase_order_items", ["purchase_order_id", "product_id"], name: :index_purchase_order_items_on_purchase_order_id_product_id, unique: true
|
60
60
|
|
61
|
-
create_table "received_items", :
|
62
|
-
t.column "received_item_id", :primary_key, :
|
63
|
-
t.column "product_id", :integer, :
|
64
|
-
t.column "purchase_order_item_id", :integer, :
|
65
|
-
t.column "transfer_request_id", :integer, :
|
66
|
-
t.column "quantity", :integer, :
|
67
|
-
t.column "receipt_id", :integer, :
|
61
|
+
create_table "received_items", id: false, force: true do |t|
|
62
|
+
t.column "received_item_id", :primary_key, null: false
|
63
|
+
t.column "product_id", :integer, null: false
|
64
|
+
t.column "purchase_order_item_id", :integer, null: true
|
65
|
+
t.column "transfer_request_id", :integer, null: true
|
66
|
+
t.column "quantity", :integer, limit: 32, null: false
|
67
|
+
t.column "receipt_id", :integer, null: true
|
68
68
|
end
|
69
69
|
|
70
70
|
|
71
|
-
create_table "sales_orders", :
|
72
|
-
t.column "sales_order_id", :primary_key, :
|
73
|
-
t.column "customer_id", :integer, :
|
74
|
-
t.column "warehouse_id", :integer, :
|
71
|
+
create_table "sales_orders", id: false, force: true do |t|
|
72
|
+
t.column "sales_order_id", :primary_key, null: false
|
73
|
+
t.column "customer_id", :integer, null: false
|
74
|
+
t.column "warehouse_id", :integer, null: false
|
75
75
|
end
|
76
76
|
|
77
77
|
|
78
|
-
create_table "sales_order_items", :
|
79
|
-
t.column "sales_order_item_id", :primary_key, :
|
80
|
-
t.column "product_id", :integer, :
|
81
|
-
t.column "sales_order_id", :integer, :
|
82
|
-
t.column "quantity", :integer, :
|
78
|
+
create_table "sales_order_items", id: false, force: true do |t|
|
79
|
+
t.column "sales_order_item_id", :primary_key, null: false
|
80
|
+
t.column "product_id", :integer, null: false
|
81
|
+
t.column "sales_order_id", :integer, null: false
|
82
|
+
t.column "quantity", :integer, limit: 32, null: false
|
83
83
|
end
|
84
84
|
|
85
|
-
add_index "sales_order_items", ["sales_order_id", "product_id"], :
|
85
|
+
add_index "sales_order_items", ["sales_order_id", "product_id"], name: :index_sales_order_items_on_sales_order_id_product_id, unique: true
|
86
86
|
|
87
|
-
create_table "transfer_requests", :
|
88
|
-
t.column "transfer_request_id", :primary_key, :
|
89
|
-
t.column "from_warehouse_id", :integer, :
|
90
|
-
t.column "product_id", :integer, :
|
91
|
-
t.column "to_warehouse_id", :integer, :
|
92
|
-
t.column "quantity", :integer, :
|
87
|
+
create_table "transfer_requests", id: false, force: true do |t|
|
88
|
+
t.column "transfer_request_id", :primary_key, null: false
|
89
|
+
t.column "from_warehouse_id", :integer, null: false
|
90
|
+
t.column "product_id", :integer, null: false
|
91
|
+
t.column "to_warehouse_id", :integer, null: false
|
92
|
+
t.column "quantity", :integer, limit: 32, null: false
|
93
93
|
end
|
94
94
|
|
95
95
|
|
96
|
-
create_table "warehouses", :
|
97
|
-
t.column "warehouse_id", :primary_key, :
|
96
|
+
create_table "warehouses", id: false, force: true do |t|
|
97
|
+
t.column "warehouse_id", :primary_key, null: false
|
98
98
|
end
|
99
99
|
|
100
100
|
|
101
101
|
unless ENV["EXCLUDE_FKS"]
|
102
|
-
add_foreign_key :back_order_allocations, :purchase_order_items, :
|
103
|
-
add_index :back_order_allocations, [:purchase_order_item_id], :
|
104
|
-
add_foreign_key :back_order_allocations, :sales_order_items, :
|
105
|
-
add_index :back_order_allocations, [:sales_order_item_id], :
|
106
|
-
add_foreign_key :bins, :products, :
|
107
|
-
add_index :bins, [:product_id], :
|
108
|
-
add_foreign_key :bins, :warehouses, :
|
109
|
-
add_index :bins, [:warehouse_id], :
|
110
|
-
add_foreign_key :dispatch_items, :products, :
|
111
|
-
add_index :dispatch_items, [:product_id], :
|
112
|
-
add_foreign_key :dispatch_items, :sales_order_items, :
|
113
|
-
add_index :dispatch_items, [:sales_order_item_id], :
|
114
|
-
add_foreign_key :dispatch_items, :transfer_requests, :
|
115
|
-
add_index :dispatch_items, [:transfer_request_id], :
|
116
|
-
add_foreign_key :purchase_orders, :parties, :
|
117
|
-
add_index :purchase_orders, [:supplier_id], :
|
118
|
-
add_foreign_key :purchase_orders, :warehouses, :
|
119
|
-
add_index :purchase_orders, [:warehouse_id], :
|
120
|
-
add_foreign_key :purchase_order_items, :products, :
|
121
|
-
add_index :purchase_order_items, [:product_id], :
|
122
|
-
add_foreign_key :purchase_order_items, :purchase_orders, :
|
123
|
-
add_index :purchase_order_items, [:purchase_order_id], :
|
124
|
-
add_foreign_key :received_items, :products, :
|
125
|
-
add_index :received_items, [:product_id], :
|
126
|
-
add_foreign_key :received_items, :purchase_order_items, :
|
127
|
-
add_index :received_items, [:purchase_order_item_id], :
|
128
|
-
add_foreign_key :received_items, :transfer_requests, :
|
129
|
-
add_index :received_items, [:transfer_request_id], :
|
130
|
-
add_foreign_key :sales_orders, :parties, :
|
131
|
-
add_index :sales_orders, [:customer_id], :
|
132
|
-
add_foreign_key :sales_orders, :warehouses, :
|
133
|
-
add_index :sales_orders, [:warehouse_id], :
|
134
|
-
add_foreign_key :sales_order_items, :products, :
|
135
|
-
add_index :sales_order_items, [:product_id], :
|
136
|
-
add_foreign_key :sales_order_items, :sales_orders, :
|
137
|
-
add_index :sales_order_items, [:sales_order_id], :
|
138
|
-
add_foreign_key :transfer_requests, :products, :
|
139
|
-
add_index :transfer_requests, [:product_id], :
|
140
|
-
add_foreign_key :transfer_requests, :warehouses, :
|
141
|
-
add_index :transfer_requests, [:from_warehouse_id], :
|
142
|
-
add_foreign_key :transfer_requests, :warehouses, :
|
143
|
-
add_index :transfer_requests, [:to_warehouse_id], :
|
102
|
+
add_foreign_key :back_order_allocations, :purchase_order_items, column: :purchase_order_item_id, primary_key: :purchase_order_item_id, on_delete: :cascade
|
103
|
+
add_index :back_order_allocations, [:purchase_order_item_id], unique: false, name: :index_back_order_allocations_on_purchase_order_item_id
|
104
|
+
add_foreign_key :back_order_allocations, :sales_order_items, column: :sales_order_item_id, primary_key: :sales_order_item_id, on_delete: :cascade
|
105
|
+
add_index :back_order_allocations, [:sales_order_item_id], unique: false, name: :index_back_order_allocations_on_sales_order_item_id
|
106
|
+
add_foreign_key :bins, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
107
|
+
add_index :bins, [:product_id], unique: false, name: :index_bins_on_product_id
|
108
|
+
add_foreign_key :bins, :warehouses, column: :warehouse_id, primary_key: :warehouse_id, on_delete: :cascade
|
109
|
+
add_index :bins, [:warehouse_id], unique: false, name: :index_bins_on_warehouse_id
|
110
|
+
add_foreign_key :dispatch_items, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
111
|
+
add_index :dispatch_items, [:product_id], unique: false, name: :index_dispatch_items_on_product_id
|
112
|
+
add_foreign_key :dispatch_items, :sales_order_items, column: :sales_order_item_id, primary_key: :sales_order_item_id, on_delete: :cascade
|
113
|
+
add_index :dispatch_items, [:sales_order_item_id], unique: false, name: :index_dispatch_items_on_sales_order_item_id
|
114
|
+
add_foreign_key :dispatch_items, :transfer_requests, column: :transfer_request_id, primary_key: :transfer_request_id, on_delete: :cascade
|
115
|
+
add_index :dispatch_items, [:transfer_request_id], unique: false, name: :index_dispatch_items_on_transfer_request_id
|
116
|
+
add_foreign_key :purchase_orders, :parties, column: :supplier_id, primary_key: :party_id, on_delete: :cascade
|
117
|
+
add_index :purchase_orders, [:supplier_id], unique: false, name: :index_purchase_orders_on_supplier_id
|
118
|
+
add_foreign_key :purchase_orders, :warehouses, column: :warehouse_id, primary_key: :warehouse_id, on_delete: :cascade
|
119
|
+
add_index :purchase_orders, [:warehouse_id], unique: false, name: :index_purchase_orders_on_warehouse_id
|
120
|
+
add_foreign_key :purchase_order_items, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
121
|
+
add_index :purchase_order_items, [:product_id], unique: false, name: :index_purchase_order_items_on_product_id
|
122
|
+
add_foreign_key :purchase_order_items, :purchase_orders, column: :purchase_order_id, primary_key: :purchase_order_id, on_delete: :cascade
|
123
|
+
add_index :purchase_order_items, [:purchase_order_id], unique: false, name: :index_purchase_order_items_on_purchase_order_id
|
124
|
+
add_foreign_key :received_items, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
125
|
+
add_index :received_items, [:product_id], unique: false, name: :index_received_items_on_product_id
|
126
|
+
add_foreign_key :received_items, :purchase_order_items, column: :purchase_order_item_id, primary_key: :purchase_order_item_id, on_delete: :cascade
|
127
|
+
add_index :received_items, [:purchase_order_item_id], unique: false, name: :index_received_items_on_purchase_order_item_id
|
128
|
+
add_foreign_key :received_items, :transfer_requests, column: :transfer_request_id, primary_key: :transfer_request_id, on_delete: :cascade
|
129
|
+
add_index :received_items, [:transfer_request_id], unique: false, name: :index_received_items_on_transfer_request_id
|
130
|
+
add_foreign_key :sales_orders, :parties, column: :customer_id, primary_key: :party_id, on_delete: :cascade
|
131
|
+
add_index :sales_orders, [:customer_id], unique: false, name: :index_sales_orders_on_customer_id
|
132
|
+
add_foreign_key :sales_orders, :warehouses, column: :warehouse_id, primary_key: :warehouse_id, on_delete: :cascade
|
133
|
+
add_index :sales_orders, [:warehouse_id], unique: false, name: :index_sales_orders_on_warehouse_id
|
134
|
+
add_foreign_key :sales_order_items, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
135
|
+
add_index :sales_order_items, [:product_id], unique: false, name: :index_sales_order_items_on_product_id
|
136
|
+
add_foreign_key :sales_order_items, :sales_orders, column: :sales_order_id, primary_key: :sales_order_id, on_delete: :cascade
|
137
|
+
add_index :sales_order_items, [:sales_order_id], unique: false, name: :index_sales_order_items_on_sales_order_id
|
138
|
+
add_foreign_key :transfer_requests, :products, column: :product_id, primary_key: :product_id, on_delete: :cascade
|
139
|
+
add_index :transfer_requests, [:product_id], unique: false, name: :index_transfer_requests_on_product_id
|
140
|
+
add_foreign_key :transfer_requests, :warehouses, column: :from_warehouse_id, primary_key: :warehouse_id, on_delete: :cascade
|
141
|
+
add_index :transfer_requests, [:from_warehouse_id], unique: false, name: :index_transfer_requests_on_from_warehouse_id
|
142
|
+
add_foreign_key :transfer_requests, :warehouses, column: :to_warehouse_id, primary_key: :warehouse_id, on_delete: :cascade
|
143
|
+
add_index :transfer_requests, [:to_warehouse_id], unique: false, name: :index_transfer_requests_on_to_warehouse_id
|
144
144
|
end
|
145
145
|
end
|
data/ruby/CinemaTickets.rb
CHANGED
@@ -35,10 +35,6 @@ module ::CinemaTickets
|
|
35
35
|
one_to_one :film # See Film.film_id
|
36
36
|
end
|
37
37
|
|
38
|
-
class HighDemand < Boolean
|
39
|
-
value_type
|
40
|
-
end
|
41
|
-
|
42
38
|
class Hour < SignedInteger
|
43
39
|
value_type :length => 32
|
44
40
|
restrict 0..23
|
@@ -172,13 +168,13 @@ module ::CinemaTickets
|
|
172
168
|
has_one :year, :mandatory => true # See Year.all_session_time
|
173
169
|
end
|
174
170
|
|
175
|
-
class
|
176
|
-
identified_by :
|
177
|
-
has_one :cinema, :mandatory => true # See Cinema.
|
178
|
-
|
179
|
-
has_one :price
|
180
|
-
has_one :section, :mandatory => true # See Section.
|
181
|
-
has_one :session_time, :mandatory => true # See SessionTime.
|
171
|
+
class TicketCategory
|
172
|
+
identified_by :cinema, :session_time, :section, :has_high_demand
|
173
|
+
has_one :cinema, :mandatory => true # See Cinema.all_ticket_category
|
174
|
+
maybe :has_high_demand
|
175
|
+
has_one :price # See Price.all_ticket_category
|
176
|
+
has_one :section, :mandatory => true # See Section.all_ticket_category
|
177
|
+
has_one :session_time, :mandatory => true # See SessionTime.all_ticket_category
|
182
178
|
end
|
183
179
|
|
184
180
|
class Session
|
data/ruby/OilSupply.rb
CHANGED
@@ -35,7 +35,7 @@ module ::OilSupply
|
|
35
35
|
restrict 'Autumn', 'Spring', 'Summer', 'Winter'
|
36
36
|
end
|
37
37
|
|
38
|
-
class
|
38
|
+
class TransportMode < String
|
39
39
|
value_type
|
40
40
|
restrict 'Rail', 'Road', 'Sea'
|
41
41
|
end
|
@@ -67,10 +67,10 @@ module ::OilSupply
|
|
67
67
|
end
|
68
68
|
|
69
69
|
class TransportRoute
|
70
|
-
identified_by :
|
70
|
+
identified_by :transport_mode, :refinery, :region
|
71
71
|
has_one :refinery, :mandatory => true # See Refinery.all_transport_route
|
72
72
|
has_one :region, :mandatory => true # See Region.all_transport_route
|
73
|
-
has_one :
|
73
|
+
has_one :transport_mode, :mandatory => true # See TransportMode.all_transport_route
|
74
74
|
has_one :cost # See Cost.all_transport_route
|
75
75
|
end
|
76
76
|
|
data/ruby/OneRoleNesting.rb
CHANGED
@@ -49,7 +49,7 @@ module ::OneRoleNesting
|
|
49
49
|
|
50
50
|
class Birth
|
51
51
|
identified_by :person
|
52
|
-
has_one :
|
52
|
+
has_one :event_date_of_birth, :class => EventDate, :mandatory => true # See EventDate.all_birth_as_event_date_of_birth
|
53
53
|
one_to_one :person, :mandatory => true # See Person.birth
|
54
54
|
has_one :attending_doctor, :class => "Doctor" # See Doctor.all_birth_as_attending_doctor
|
55
55
|
end
|
@@ -153,26 +153,26 @@ CREATE TABLE Session (
|
|
153
153
|
)
|
154
154
|
GO
|
155
155
|
|
156
|
-
CREATE TABLE
|
157
|
-
-- Ticket
|
156
|
+
CREATE TABLE TicketCategory (
|
157
|
+
-- Ticket Category is for Cinema and Cinema has Cinema ID,
|
158
158
|
CinemaID int NOT NULL,
|
159
|
-
-- Ticket
|
160
|
-
|
161
|
-
-- Ticket
|
162
|
-
Price decimal
|
163
|
-
-- Ticket
|
159
|
+
-- Ticket Category has high demand,
|
160
|
+
HasHighDemand bit NULL,
|
161
|
+
-- maybe Ticket Category has Price,
|
162
|
+
Price decimal NULL,
|
163
|
+
-- Ticket Category is for Section and Section has Section Name,
|
164
164
|
SectionName varchar NOT NULL,
|
165
|
-
-- Ticket
|
165
|
+
-- Ticket Category is for Session Time and Session Time is on Day,
|
166
166
|
SessionTimeDay int NOT NULL CHECK((SessionTimeDay >= 1 AND SessionTimeDay <= 31)),
|
167
|
-
-- Ticket
|
167
|
+
-- Ticket Category is for Session Time and Session Time is at Hour,
|
168
168
|
SessionTimeHour int NOT NULL CHECK((SessionTimeHour >= 0 AND SessionTimeHour <= 23)),
|
169
|
-
-- Ticket
|
169
|
+
-- Ticket Category is for Session Time and Session Time is at Minute,
|
170
170
|
SessionTimeMinute int NOT NULL CHECK((SessionTimeMinute >= 0 AND SessionTimeMinute <= 59)),
|
171
|
-
-- Ticket
|
171
|
+
-- Ticket Category is for Session Time and Session Time is in Month and Month has Month Nr,
|
172
172
|
SessionTimeMonthNr int NOT NULL CHECK((SessionTimeMonthNr >= 1 AND SessionTimeMonthNr <= 12)),
|
173
|
-
-- Ticket
|
173
|
+
-- Ticket Category is for Session Time and Session Time is in Year and Year has Year Nr,
|
174
174
|
SessionTimeYearNr int NOT NULL CHECK((SessionTimeYearNr >= 1900 AND SessionTimeYearNr <= 9999)),
|
175
|
-
|
175
|
+
UNIQUE(CinemaID, SessionTimeYearNr, SessionTimeMonthNr, SessionTimeDay, SessionTimeHour, SessionTimeMinute, SectionName, HasHighDemand),
|
176
176
|
FOREIGN KEY (CinemaID) REFERENCES Cinema (CinemaID)
|
177
177
|
)
|
178
178
|
GO
|