composite_primary_keys 14.0.9 → 14.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +10 -0
  3. data/README.rdoc +182 -182
  4. data/Rakefile +37 -37
  5. data/lib/composite_primary_keys/associations/collection_association.rb +38 -38
  6. data/lib/composite_primary_keys/associations/preloader/association.rb +52 -52
  7. data/lib/composite_primary_keys/autosave_association.rb +60 -60
  8. data/lib/composite_primary_keys/composite_arrays.rb +88 -88
  9. data/lib/composite_primary_keys/composite_predicates.rb +121 -121
  10. data/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb +36 -36
  11. data/lib/composite_primary_keys/core.rb +71 -48
  12. data/lib/composite_primary_keys/persistence.rb +96 -96
  13. data/lib/composite_primary_keys/reflection.rb +93 -91
  14. data/lib/composite_primary_keys/relation/calculations.rb +110 -110
  15. data/lib/composite_primary_keys/relation/query_methods.rb +40 -40
  16. data/lib/composite_primary_keys/relation.rb +199 -199
  17. data/lib/composite_primary_keys/validations/uniqueness.rb +40 -40
  18. data/lib/composite_primary_keys/version.rb +1 -1
  19. data/lib/composite_primary_keys.rb +117 -117
  20. data/scripts/console.rb +48 -48
  21. data/tasks/databases/trilogy.rake +23 -23
  22. data/test/abstract_unit.rb +124 -124
  23. data/test/connections/databases.ci.yml +32 -32
  24. data/test/fixtures/admin.rb +4 -4
  25. data/test/fixtures/db_definitions/db2-create-tables.sql +146 -146
  26. data/test/fixtures/db_definitions/db2-drop-tables.sql +23 -23
  27. data/test/fixtures/db_definitions/mysql.sql +203 -203
  28. data/test/fixtures/db_definitions/oracle.drop.sql +45 -45
  29. data/test/fixtures/db_definitions/oracle.sql +220 -220
  30. data/test/fixtures/db_definitions/postgresql.sql +205 -205
  31. data/test/fixtures/db_definitions/sqlite.sql +190 -190
  32. data/test/fixtures/db_definitions/sqlserver.sql +199 -199
  33. data/test/fixtures/department.rb +20 -20
  34. data/test/fixtures/moderator.rb +4 -4
  35. data/test/fixtures/room.rb +14 -14
  36. data/test/fixtures/room_assignment.rb +18 -18
  37. data/test/fixtures/staff_room.rb +6 -6
  38. data/test/fixtures/staff_room_key.rb +6 -6
  39. data/test/fixtures/user.rb +14 -14
  40. data/test/test_associations.rb +403 -403
  41. data/test/test_composite_arrays.rb +44 -44
  42. data/test/test_equal.rb +55 -26
  43. data/test/test_has_one_through.rb +30 -30
  44. data/test/test_hash.rb +73 -0
  45. data/test/test_nested_attributes.rb +90 -90
  46. metadata +7 -8
@@ -1,206 +1,206 @@
1
- create table reference_types (
2
- reference_type_id serial not null,
3
- type_label varchar(50) default null,
4
- abbreviation varchar(50) default null,
5
- description varchar(50) default null,
6
- primary key (reference_type_id)
7
- );
8
-
9
- create table reference_codes (
10
- reference_type_id int,
11
- reference_code int not null,
12
- code_label varchar(50) default null,
13
- abbreviation varchar(50) default null,
14
- description varchar(50) default null,
15
- primary key (reference_type_id, reference_code)
16
- );
17
-
18
- create table products (
19
- id serial not null,
20
- name varchar(50) default null,
21
- primary key (id),
22
- created_at timestamp without time zone NOT NULL,
23
- updated_at timestamp without time zone NOT NULL
24
- );
25
-
26
- create table tariffs (
27
- tariff_id int not null,
28
- start_date date not null,
29
- amount int default null,
30
- created_at timestamp without time zone NOT NULL,
31
- updated_at timestamp without time zone NOT NULL,
32
- primary key (tariff_id, start_date)
33
- );
34
-
35
- create table product_tariffs (
36
- product_id int not null,
37
- tariff_id int not null,
38
- tariff_start_date date not null,
39
- primary key (product_id, tariff_id, tariff_start_date)
40
- );
41
-
42
- create table suburbs (
43
- city_id serial not null,
44
- suburb_id serial not null,
45
- name varchar(50) not null,
46
- primary key (city_id, suburb_id)
47
- );
48
-
49
- create table streets (
50
- id serial not null,
51
- city_id int not null,
52
- suburb_id int not null,
53
- name varchar(50) not null,
54
- primary key (id)
55
- );
56
-
57
- create table users (
58
- id serial not null,
59
- name varchar(50) not null,
60
- primary key (id)
61
- );
62
-
63
- create table moderators (
64
- id serial not null,
65
- primary key (id)
66
- );
67
-
68
- create table admins (
69
- id serial not null,
70
- primary key (id)
71
- );
72
-
73
- create table articles (
74
- id serial not null,
75
- name varchar(50) not null,
76
- primary key (id)
77
- );
78
-
79
- create table readings (
80
- id serial not null,
81
- user_id int not null,
82
- article_id int not null,
83
- rating int not null,
84
- primary key (id)
85
- );
86
-
87
- create table groups (
88
- id serial not null,
89
- name varchar(50) not null,
90
- primary key (id)
91
- );
92
-
93
- create table memberships (
94
- user_id int not null,
95
- group_id int not null,
96
- primary key (user_id, group_id)
97
- );
98
-
99
- create table membership_statuses (
100
- id serial not null,
101
- user_id int not null,
102
- group_id int not null,
103
- status varchar(50) not null,
104
- primary key (id)
105
- );
106
-
107
- create table departments (
108
- id serial not null,
109
- location_id int not null,
110
- primary key (id, location_id)
111
- );
112
-
113
- create table employees (
114
- id serial not null,
115
- department_id int default null,
116
- location_id int default null,
117
- name text not null,
118
- primary key (id)
119
- );
120
-
121
- create table comments (
122
- id serial not null,
123
- article_id int not null references articles (id),
124
- person_id int not null,
125
- person_type varchar(100) not null,
126
- primary key (id)
127
- );
128
-
129
- create table restaurants (
130
- franchise_id int not null,
131
- store_id int not null,
132
- name varchar(100),
133
- lock_version int default 0,
134
- primary key (franchise_id, store_id)
135
- );
136
-
137
- create table restaurants_suburbs (
138
- franchise_id int not null,
139
- store_id int not null,
140
- city_id int not null,
141
- suburb_id int not null
142
- );
143
-
144
- create table dorms (
145
- id serial not null,
146
- primary key (id)
147
- );
148
-
149
- create table rooms (
150
- dorm_id int not null,
151
- room_id int not null,
152
- primary key (dorm_id, room_id)
153
- );
154
-
155
- create table room_attributes (
156
- id serial not null,
157
- name varchar(50),
158
- primary key (id)
159
- );
160
-
161
- create table room_attribute_assignments (
162
- dorm_id int not null,
163
- room_id int not null,
164
- room_attribute_id int not null
165
- );
166
-
167
- create table staff_rooms (
168
- dorm_id int not null,
169
- room_id int not null,
170
- primary key (dorm_id, room_id)
171
- );
172
-
173
- create table staff_room_keys (
174
- dorm_id int not null,
175
- room_id int not null,
176
- key_no varchar(50) not null,
177
- primary key (dorm_id, room_id)
178
- );
179
-
180
- create table students (
181
- id serial not null,
182
- primary key (id)
183
- );
184
-
185
- create table room_assignments (
186
- student_id int not null,
187
- dorm_id int not null,
188
- room_id int not null
189
- );
190
-
191
- create table capitols (
192
- country text not null,
193
- city text not null,
194
- primary key (country, city)
195
- );
196
-
197
- create table products_restaurants (
198
- product_id int not null,
199
- franchise_id int not null,
200
- store_id int not null
201
- );
202
-
203
- create table employees_groups (
204
- employee_id int not null,
205
- group_id int not null
1
+ create table reference_types (
2
+ reference_type_id serial not null,
3
+ type_label varchar(50) default null,
4
+ abbreviation varchar(50) default null,
5
+ description varchar(50) default null,
6
+ primary key (reference_type_id)
7
+ );
8
+
9
+ create table reference_codes (
10
+ reference_type_id int,
11
+ reference_code int not null,
12
+ code_label varchar(50) default null,
13
+ abbreviation varchar(50) default null,
14
+ description varchar(50) default null,
15
+ primary key (reference_type_id, reference_code)
16
+ );
17
+
18
+ create table products (
19
+ id serial not null,
20
+ name varchar(50) default null,
21
+ primary key (id),
22
+ created_at timestamp without time zone NOT NULL,
23
+ updated_at timestamp without time zone NOT NULL
24
+ );
25
+
26
+ create table tariffs (
27
+ tariff_id int not null,
28
+ start_date date not null,
29
+ amount int default null,
30
+ created_at timestamp without time zone NOT NULL,
31
+ updated_at timestamp without time zone NOT NULL,
32
+ primary key (tariff_id, start_date)
33
+ );
34
+
35
+ create table product_tariffs (
36
+ product_id int not null,
37
+ tariff_id int not null,
38
+ tariff_start_date date not null,
39
+ primary key (product_id, tariff_id, tariff_start_date)
40
+ );
41
+
42
+ create table suburbs (
43
+ city_id serial not null,
44
+ suburb_id serial not null,
45
+ name varchar(50) not null,
46
+ primary key (city_id, suburb_id)
47
+ );
48
+
49
+ create table streets (
50
+ id serial not null,
51
+ city_id int not null,
52
+ suburb_id int not null,
53
+ name varchar(50) not null,
54
+ primary key (id)
55
+ );
56
+
57
+ create table users (
58
+ id serial not null,
59
+ name varchar(50) not null,
60
+ primary key (id)
61
+ );
62
+
63
+ create table moderators (
64
+ id serial not null,
65
+ primary key (id)
66
+ );
67
+
68
+ create table admins (
69
+ id serial not null,
70
+ primary key (id)
71
+ );
72
+
73
+ create table articles (
74
+ id serial not null,
75
+ name varchar(50) not null,
76
+ primary key (id)
77
+ );
78
+
79
+ create table readings (
80
+ id serial not null,
81
+ user_id int not null,
82
+ article_id int not null,
83
+ rating int not null,
84
+ primary key (id)
85
+ );
86
+
87
+ create table groups (
88
+ id serial not null,
89
+ name varchar(50) not null,
90
+ primary key (id)
91
+ );
92
+
93
+ create table memberships (
94
+ user_id int not null,
95
+ group_id int not null,
96
+ primary key (user_id, group_id)
97
+ );
98
+
99
+ create table membership_statuses (
100
+ id serial not null,
101
+ user_id int not null,
102
+ group_id int not null,
103
+ status varchar(50) not null,
104
+ primary key (id)
105
+ );
106
+
107
+ create table departments (
108
+ id serial not null,
109
+ location_id int not null,
110
+ primary key (id, location_id)
111
+ );
112
+
113
+ create table employees (
114
+ id serial not null,
115
+ department_id int default null,
116
+ location_id int default null,
117
+ name text not null,
118
+ primary key (id)
119
+ );
120
+
121
+ create table comments (
122
+ id serial not null,
123
+ article_id int not null references articles (id),
124
+ person_id int not null,
125
+ person_type varchar(100) not null,
126
+ primary key (id)
127
+ );
128
+
129
+ create table restaurants (
130
+ franchise_id int not null,
131
+ store_id int not null,
132
+ name varchar(100),
133
+ lock_version int default 0,
134
+ primary key (franchise_id, store_id)
135
+ );
136
+
137
+ create table restaurants_suburbs (
138
+ franchise_id int not null,
139
+ store_id int not null,
140
+ city_id int not null,
141
+ suburb_id int not null
142
+ );
143
+
144
+ create table dorms (
145
+ id serial not null,
146
+ primary key (id)
147
+ );
148
+
149
+ create table rooms (
150
+ dorm_id int not null,
151
+ room_id int not null,
152
+ primary key (dorm_id, room_id)
153
+ );
154
+
155
+ create table room_attributes (
156
+ id serial not null,
157
+ name varchar(50),
158
+ primary key (id)
159
+ );
160
+
161
+ create table room_attribute_assignments (
162
+ dorm_id int not null,
163
+ room_id int not null,
164
+ room_attribute_id int not null
165
+ );
166
+
167
+ create table staff_rooms (
168
+ dorm_id int not null,
169
+ room_id int not null,
170
+ primary key (dorm_id, room_id)
171
+ );
172
+
173
+ create table staff_room_keys (
174
+ dorm_id int not null,
175
+ room_id int not null,
176
+ key_no varchar(50) not null,
177
+ primary key (dorm_id, room_id)
178
+ );
179
+
180
+ create table students (
181
+ id serial not null,
182
+ primary key (id)
183
+ );
184
+
185
+ create table room_assignments (
186
+ student_id int not null,
187
+ dorm_id int not null,
188
+ room_id int not null
189
+ );
190
+
191
+ create table capitols (
192
+ country text not null,
193
+ city text not null,
194
+ primary key (country, city)
195
+ );
196
+
197
+ create table products_restaurants (
198
+ product_id int not null,
199
+ franchise_id int not null,
200
+ store_id int not null
201
+ );
202
+
203
+ create table employees_groups (
204
+ employee_id int not null,
205
+ group_id int not null
206
206
  );