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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/activefacts-examples.gemspec +2 -2
  4. data/cql/CinemaBookings.cql +7 -1
  5. data/cql/CinemaTickets.cql +6 -3
  6. data/cql/CompanyDirectorEmployee.cql +1 -1
  7. data/cql/Diplomacy.cql +2 -2
  8. data/cql/OilSupply.cql +3 -3
  9. data/cql/OneRoleNesting.cql +1 -1
  10. data/cql/SeparateSubtype.cql +6 -0
  11. data/cql/ServiceDirector.cql +13 -13
  12. data/cql/Supervision.cql +2 -3
  13. data/cql/Warehousing.cql +4 -4
  14. data/diagrams/json/CinemaTickets.json +7 -4
  15. data/diagrams/json/OilSupply.json +4 -4
  16. data/diagrams/json/OneRoleNesting.json +1 -1
  17. data/images/CinemaTickets.png +0 -0
  18. data/images/MultipleSubtyping.png +0 -0
  19. data/images/OilSupply.png +0 -0
  20. data/metadata/json/CinemaTickets.json +141 -149
  21. data/metadata/json/Metamodel.json +747 -466
  22. data/metadata/json/OilSupply.json +63 -63
  23. data/orm/Blog.orm +214 -214
  24. data/orm/CinemaTickets.orm +931 -962
  25. data/orm/ExampleModels2010.csproj +33 -0
  26. data/orm/MultipleSubtyping.orm +110 -9
  27. data/orm/OilSupply.orm +347 -353
  28. data/orm/Warehousing.orm +34 -22
  29. data/rails/models/CinemaTickets.models +5 -7
  30. data/rails/schema/Astronomy.schema.rb +14 -14
  31. data/rails/schema/CinemaBookings.schema.rb +49 -49
  32. data/rails/schema/CinemaTickets.schema.rb +97 -97
  33. data/rails/schema/Diplomacy.schema.rb +48 -48
  34. data/rails/schema/Metamodel.schema.rb +497 -497
  35. data/rails/schema/SeparateSubtype.schema.rb +18 -18
  36. data/rails/schema/VenueSeating.schema.rb +26 -26
  37. data/rails/schema/Warehousing.schema.rb +101 -101
  38. data/ruby/CinemaTickets.rb +7 -11
  39. data/ruby/OilSupply.rb +3 -3
  40. data/ruby/OneRoleNesting.rb +1 -1
  41. data/sql/server/CinemaTickets.sql +13 -13
  42. data/sql/server/OilSupply.sql +3 -3
  43. data/sql/server/OneRoleNesting.sql +6 -6
  44. metadata +8 -7
@@ -1,35 +1,35 @@
1
1
  #
2
- # schema.rb auto-generated using ActiveFacts for SeparateSubtype on 2015-07-08
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(:version => 20150708011603) do
6
+ ActiveRecord::Schema.define(version: 20160623164302) do
7
7
  enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
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
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", :id => false, :force => true do |t|
16
- t.column "person_id", :primary_key, :null => false
17
- t.column "person_name", :string, :null => false
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"], :name => :index_people_on_person_name, :unique => true
20
+ add_index "people", ["person_name"], name: :index_people_on_person_name, unique: true
21
21
 
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
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, :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
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 2015-07-08
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(:version => 20150708011603) do
6
+ ActiveRecord::Schema.define(version: 20160623164308) do
7
7
  enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
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
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", :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
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"], :name => :index_seats_on_venue_id_reserve_name_row_code_number, :unique => true
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", :id => false, :force => true do |t|
25
- t.column "event_id", :integer, :null => false
26
- t.column "seat_id", :integer, :null => false
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"], :name => :index_tickets_on_event_id_seat_id, :unique => true
29
+ add_index "tickets", ["event_id", "seat_id"], name: :index_tickets_on_event_id_seat_id, unique: true
30
30
 
31
- create_table "venues", :id => false, :force => true do |t|
32
- t.column "venue_id", :primary_key, :null => false
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, :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
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 2015-07-08
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(:version => 20150708011604) do
6
+ ActiveRecord::Schema.define(version: 20160623164308) do
7
7
  enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
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
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"], :name => :index_back_order_allocations_on_purchase_order_item_i__1a63f970, :unique => true
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", :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
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", :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
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", :id => false, :force => true do |t|
36
- t.column "party_id", :primary_key, :null => false
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", :id => false, :force => true do |t|
41
- t.column "product_id", :primary_key, :null => false
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", :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
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", :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
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"], :name => :index_purchase_order_items_on_purchase_order_id_product_id, :unique => true
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", :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
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", :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
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", :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
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"], :name => :index_sales_order_items_on_sales_order_id_product_id, :unique => true
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", :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
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", :id => false, :force => true do |t|
97
- t.column "warehouse_id", :primary_key, :null => false
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, :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
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
@@ -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 TicketPricing
176
- identified_by :session_time, :cinema, :section, :high_demand
177
- has_one :cinema, :mandatory => true # See Cinema.all_ticket_pricing
178
- has_one :high_demand, :mandatory => true # See HighDemand.all_ticket_pricing
179
- has_one :price, :mandatory => true # See Price.all_ticket_pricing
180
- has_one :section, :mandatory => true # See Section.all_ticket_pricing
181
- has_one :session_time, :mandatory => true # See SessionTime.all_ticket_pricing
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
@@ -35,7 +35,7 @@ module ::OilSupply
35
35
  restrict 'Autumn', 'Spring', 'Summer', 'Winter'
36
36
  end
37
37
 
38
- class TransportMethod < String
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 :transport_method, :refinery, :region
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 :transport_method, :mandatory => true # See TransportMethod.all_transport_route
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
 
@@ -49,7 +49,7 @@ module ::OneRoleNesting
49
49
 
50
50
  class Birth
51
51
  identified_by :person
52
- has_one :event_date, :mandatory => true # See EventDate.all_birth
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 TicketPricing (
157
- -- Ticket Pricing involves Cinema and Cinema has Cinema ID,
156
+ CREATE TABLE TicketCategory (
157
+ -- Ticket Category is for Cinema and Cinema has Cinema ID,
158
158
  CinemaID int NOT NULL,
159
- -- Ticket Pricing involves High Demand,
160
- HighDemand Boolean NOT NULL,
161
- -- Ticket Pricing involves Price,
162
- Price decimal NOT NULL,
163
- -- Ticket Pricing involves Section and Section has Section Name,
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 Pricing involves Session Time and Session Time is on Day,
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 Pricing involves Session Time and Session Time is at Hour,
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 Pricing involves Session Time and Session Time is at Minute,
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 Pricing involves Session Time and Session Time is in Month and Month has Month Nr,
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 Pricing involves Session Time and Session Time is in Year and Year has Year Nr,
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
- PRIMARY KEY(SessionTimeYearNr, SessionTimeMonthNr, SessionTimeDay, SessionTimeHour, SessionTimeMinute, CinemaID, SectionName, HighDemand),
175
+ UNIQUE(CinemaID, SessionTimeYearNr, SessionTimeMonthNr, SessionTimeDay, SessionTimeHour, SessionTimeMinute, SectionName, HasHighDemand),
176
176
  FOREIGN KEY (CinemaID) REFERENCES Cinema (CinemaID)
177
177
  )
178
178
  GO