composite_primary_keys 7.0.15 → 7.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +4 -0
  3. data/lib/composite_primary_keys.rb +5 -0
  4. data/lib/composite_primary_keys/arel/visitors/to_sql.rb +20 -0
  5. data/lib/composite_primary_keys/associations/join_dependency/join_association.rb +22 -22
  6. data/lib/composite_primary_keys/associations/preloader/belongs_to.rb +19 -19
  7. data/lib/composite_primary_keys/composite_predicates.rb +50 -50
  8. data/lib/composite_primary_keys/composite_relation.rb +48 -48
  9. data/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +60 -46
  10. data/lib/composite_primary_keys/fixtures.rb +22 -22
  11. data/lib/composite_primary_keys/locking/optimistic.rb +55 -55
  12. data/lib/composite_primary_keys/relation/query_methods.rb +40 -40
  13. data/lib/composite_primary_keys/version.rb +1 -1
  14. data/tasks/databases/oracle.rake +25 -25
  15. data/test/connections/databases.ci.yml +15 -15
  16. data/test/connections/native_oracle/connection.rb +11 -11
  17. data/test/connections/native_oracle_enhanced/connection.rb +16 -16
  18. data/test/fixtures/comment.rb +7 -7
  19. data/test/fixtures/db_definitions/db2-create-tables.sql +126 -126
  20. data/test/fixtures/db_definitions/db2-drop-tables.sql +18 -18
  21. data/test/fixtures/db_definitions/oracle.drop.sql +45 -45
  22. data/test/fixtures/db_definitions/oracle.sql +223 -223
  23. data/test/fixtures/dorm.rb +2 -2
  24. data/test/fixtures/membership.rb +6 -6
  25. data/test/fixtures/membership_statuses.yml +16 -16
  26. data/test/fixtures/memberships.yml +10 -10
  27. data/test/fixtures/product_tariffs.yml +14 -14
  28. data/test/fixtures/reference_code.rb +7 -7
  29. data/test/fixtures/restaurants_suburb.rb +2 -2
  30. data/test/fixtures/suburb.rb +5 -5
  31. data/test/fixtures/topic.rb +5 -5
  32. data/test/fixtures/topic_source.rb +6 -6
  33. data/test/fixtures/topic_sources.yml +3 -3
  34. data/test/fixtures/topics.yml +8 -8
  35. data/test/fixtures/users.yml +10 -10
  36. data/test/test_attribute_methods.rb +63 -63
  37. data/test/test_calculations.rb +42 -42
  38. data/test/test_callbacks.rb +99 -99
  39. data/test/test_delete_all.rb +5 -0
  40. data/test/test_dumpable.rb +15 -15
  41. data/test/test_nested_attributes.rb +124 -124
  42. data/test/test_optimistic.rb +18 -18
  43. data/test/test_predicates.rb +40 -40
  44. data/test/test_santiago.rb +23 -23
  45. data/test/test_suite.rb +34 -34
  46. data/test/test_touch.rb +23 -23
  47. data/test/test_update.rb +71 -71
  48. metadata +4 -3
@@ -1,19 +1,19 @@
1
- drop table MEMBERSHIPS;
2
- drop table REFERENCE_CODES;
3
- drop table TARIFFS;
4
- drop table ARTICLES;
5
- drop table GROUPS;
6
- drop table MEMBERSHIP_STATUSES;
7
- drop table READINGS;
8
- drop table REFERENCE_TYPES;
9
- drop table STREETS;
10
- drop table PRODUCTS;
11
- drop table USERS;
12
- drop table SUBURBS;
13
- drop table PRODUCT_TARIFFS;
14
- drop table KITCHEN_SINK;
15
- drop table RESTAURANTS;
16
- drop table RESTAURANTS_SUBURBS;
17
- drop table PRODUCTS_RESTAURANTS;
18
- drop table TOPICS;
1
+ drop table MEMBERSHIPS;
2
+ drop table REFERENCE_CODES;
3
+ drop table TARIFFS;
4
+ drop table ARTICLES;
5
+ drop table GROUPS;
6
+ drop table MEMBERSHIP_STATUSES;
7
+ drop table READINGS;
8
+ drop table REFERENCE_TYPES;
9
+ drop table STREETS;
10
+ drop table PRODUCTS;
11
+ drop table USERS;
12
+ drop table SUBURBS;
13
+ drop table PRODUCT_TARIFFS;
14
+ drop table KITCHEN_SINK;
15
+ drop table RESTAURANTS;
16
+ drop table RESTAURANTS_SUBURBS;
17
+ drop table PRODUCTS_RESTAURANTS;
18
+ drop table TOPICS;
19
19
  drop table TOPIC_SOURCES;
@@ -1,45 +1,45 @@
1
- drop table topics;
2
- drop sequence topics_seq;
3
- drop table topic_sources;
4
- drop table reference_types;
5
- drop sequence reference_types_seq;
6
- drop table reference_codes;
7
- drop table products;
8
- drop sequence products_seq;
9
- drop table tariffs;
10
- drop table product_tariffs;
11
- drop table suburbs;
12
- drop table streets;
13
- drop sequence streets_seq;
14
- drop table users;
15
- drop sequence users_seq;
16
- drop table articles;
17
- drop sequence articles_seq;
18
- drop table readings;
19
- drop sequence readings_seq;
20
- drop table groups;
21
- drop sequence groups_seq;
22
- drop table memberships;
23
- drop table membership_statuses;
24
- drop sequence membership_statuses_seq;
25
- drop table departments;
26
- drop table employees;
27
- drop sequence employees_seq;
28
- drop table comments;
29
- drop sequence comments_seq;
30
- drop table hacks;
31
- drop sequence hacks_seq;
32
- drop table restaurants;
33
- drop table restaurants_suburbs;
34
- drop table dorms;
35
- drop sequence dorms_seq;
36
- drop table rooms;
37
- drop table room_attributes;
38
- drop sequence room_attributes_seq;
39
- drop table room_attribute_assignments;
40
- drop table room_assignments;
41
- drop table students;
42
- drop sequence students_seq;
43
- drop table seats;
44
- drop table capitols;
45
- drop table products_restaurants;
1
+ drop table topics;
2
+ drop sequence topics_seq;
3
+ drop table topic_sources;
4
+ drop table reference_types;
5
+ drop sequence reference_types_seq;
6
+ drop table reference_codes;
7
+ drop table products;
8
+ drop sequence products_seq;
9
+ drop table tariffs;
10
+ drop table product_tariffs;
11
+ drop table suburbs;
12
+ drop table streets;
13
+ drop sequence streets_seq;
14
+ drop table users;
15
+ drop sequence users_seq;
16
+ drop table articles;
17
+ drop sequence articles_seq;
18
+ drop table readings;
19
+ drop sequence readings_seq;
20
+ drop table groups;
21
+ drop sequence groups_seq;
22
+ drop table memberships;
23
+ drop table membership_statuses;
24
+ drop sequence membership_statuses_seq;
25
+ drop table departments;
26
+ drop table employees;
27
+ drop sequence employees_seq;
28
+ drop table comments;
29
+ drop sequence comments_seq;
30
+ drop table hacks;
31
+ drop sequence hacks_seq;
32
+ drop table restaurants;
33
+ drop table restaurants_suburbs;
34
+ drop table dorms;
35
+ drop sequence dorms_seq;
36
+ drop table rooms;
37
+ drop table room_attributes;
38
+ drop sequence room_attributes_seq;
39
+ drop table room_attribute_assignments;
40
+ drop table room_assignments;
41
+ drop table students;
42
+ drop sequence students_seq;
43
+ drop table seats;
44
+ drop table capitols;
45
+ drop table products_restaurants;
@@ -1,223 +1,223 @@
1
- create sequence topics_seq start with 1000;
2
-
3
- create table topics (
4
- id number(11) primary key,
5
- name varchar(50) default null,
6
- feed_size number(11) default null,
7
- );
8
-
9
- create table topic_sources (
10
- topic_id number(11),
11
- platform varchar(50),
12
- keywords varchar(50) default null,
13
- );
14
-
15
- create sequence reference_types_seq start with 1000;
16
-
17
- create table reference_types (
18
- reference_type_id number(11) primary key,
19
- type_label varchar2(50) default null,
20
- abbreviation varchar2(50) default null,
21
- description varchar2(50) default null
22
- );
23
-
24
- create table reference_codes (
25
- reference_type_id number(11),
26
- reference_code number(11),
27
- code_label varchar2(50) default null,
28
- abbreviation varchar2(50) default null,
29
- description varchar2(50) default null
30
- );
31
-
32
- create sequence products_seq start with 1000;
33
-
34
- create table products (
35
- id number(11) primary key,
36
- name varchar2(50) default null
37
- );
38
-
39
- create table tariffs (
40
- tariff_id number(11),
41
- start_date date,
42
- amount number(11) default null,
43
- constraint tariffs_pk primary key (tariff_id, start_date)
44
- );
45
-
46
- create table product_tariffs (
47
- product_id number(11),
48
- tariff_id number(11),
49
- tariff_start_date date,
50
- constraint product_tariffs_pk primary key (product_id, tariff_id, tariff_start_date)
51
- );
52
-
53
- create table suburbs (
54
- city_id number(11),
55
- suburb_id number(11),
56
- name varchar2(50) not null,
57
- constraint suburbs_pk primary key (city_id, suburb_id)
58
- );
59
-
60
- create sequence streets_seq start with 1000;
61
-
62
- create table streets (
63
- id number(11) primary key,
64
- city_id number(11) not null,
65
- suburb_id number(11) not null,
66
- name varchar2(50) not null
67
- );
68
-
69
- create sequence users_seq start with 1000;
70
-
71
- create table users (
72
- id number(11) primary key,
73
- name varchar2(50) not null
74
- );
75
-
76
- create sequence articles_seq start with 1000;
77
-
78
- create table articles (
79
- id number(11) primary key,
80
- name varchar2(50) not null
81
- );
82
-
83
- create sequence readings_seq start with 1000;
84
-
85
- create table readings (
86
- id number(11) primary key,
87
- user_id number(11) not null,
88
- article_id number(11) not null,
89
- rating number(11) not null
90
- );
91
-
92
- create sequence groups_seq start with 1000;
93
-
94
- create table groups (
95
- id number(11) primary key,
96
- name varchar2(50) not null
97
- );
98
-
99
- create table memberships (
100
- user_id number(11) not null,
101
- group_id number(11) not null,
102
- constraint memberships_pk primary key (user_id, group_id)
103
- );
104
-
105
- create sequence membership_statuses_seq start with 1000;
106
-
107
- create table membership_statuses (
108
- id number(11) primary key,
109
- user_id number(11) not null,
110
- group_id number(11) not null,
111
- status varchar2(50) not null
112
- );
113
-
114
- create table departments (
115
- department_id number(11) not null,
116
- location_id number(11) not null,
117
- constraint departments_pk primary key (department_id, location_id)
118
- );
119
-
120
- create sequence employees_seq start with 1000;
121
-
122
- create table employees (
123
- id number(11) not null primary key,
124
- department_id number(11) default null,
125
- location_id number(11) default null
126
- );
127
-
128
- create sequence comments_seq start with 1000;
129
-
130
- create table comments (
131
- id number(11) not null primary key,
132
- person_id number(11) default null,
133
- shown number(11) default null,
134
- person_type varchar(100) default null,
135
- hack_id number(11) default null
136
- );
137
-
138
- create sequence hacks_seq start with 1000;
139
-
140
- create table hacks (
141
- id number(11) not null primary key,
142
- name varchar(50) not null
143
- );
144
-
145
- create table restaurants (
146
- franchise_id number(11) not null,
147
- store_id number(11) not null,
148
- name varchar(100),
149
- lock_version number(11) default 0,
150
- constraint restaurants_pk primary key (franchise_id, store_id)
151
- );
152
-
153
- create table restaurants_suburbs (
154
- franchise_id number(11) not null,
155
- store_id number(11) not null,
156
- city_id number(11) not null,
157
- suburb_id number(11) not null
158
- );
159
-
160
- create sequence dorms_seq start with 1000;
161
-
162
- create table dorms (
163
- id number(11) not null,
164
- constraint dorms_pk primary key (id)
165
- );
166
-
167
- create table rooms (
168
- dorm_id number(11) not null,
169
- room_id number(11) not null,
170
- constraint rooms_pk primary key (dorm_id, room_id)
171
- );
172
-
173
- create sequence room_attributes_seq start with 1000;
174
-
175
- create table room_attributes (
176
- id number(11) not null,
177
- name varchar(50),
178
- constraint room_attributes_pk primary key (id)
179
- );
180
-
181
- create table room_attribute_assignments (
182
- dorm_id number(11) not null,
183
- room_id number(11) not null,
184
- room_attribute_id number(11) not null
185
- );
186
-
187
- create sequence students_seq start with 1000;
188
-
189
- create table students (
190
- id number(11) not null,
191
- constraint students_pk primary key (id)
192
- );
193
-
194
- create table room_assignments (
195
- student_id number(11) not null,
196
- dorm_id number(11) not null,
197
- room_id number(11) not null
198
- );
199
-
200
- create table seats (
201
- flight_number int not null,
202
- seat int not null,
203
- customer int,
204
- primary key (flight_number, seat)
205
- );
206
-
207
- create table capitols (
208
- country varchar2(2000) not null,
209
- city varchar2(2000) not null,
210
- primary key (country, city)
211
- );
212
-
213
- create table products_restaurants (
214
- product_id number(11) not null,
215
- franchise_id number(11) not null,
216
- store_id number(11) not null
217
- );
218
-
219
- create table employees_groups (
220
- employee_id int not null,
221
- group_id int not null
222
- );
223
-
1
+ create sequence topics_seq start with 1000;
2
+
3
+ create table topics (
4
+ id number(11) primary key,
5
+ name varchar(50) default null,
6
+ feed_size number(11) default null,
7
+ );
8
+
9
+ create table topic_sources (
10
+ topic_id number(11),
11
+ platform varchar(50),
12
+ keywords varchar(50) default null,
13
+ );
14
+
15
+ create sequence reference_types_seq start with 1000;
16
+
17
+ create table reference_types (
18
+ reference_type_id number(11) primary key,
19
+ type_label varchar2(50) default null,
20
+ abbreviation varchar2(50) default null,
21
+ description varchar2(50) default null
22
+ );
23
+
24
+ create table reference_codes (
25
+ reference_type_id number(11),
26
+ reference_code number(11),
27
+ code_label varchar2(50) default null,
28
+ abbreviation varchar2(50) default null,
29
+ description varchar2(50) default null
30
+ );
31
+
32
+ create sequence products_seq start with 1000;
33
+
34
+ create table products (
35
+ id number(11) primary key,
36
+ name varchar2(50) default null
37
+ );
38
+
39
+ create table tariffs (
40
+ tariff_id number(11),
41
+ start_date date,
42
+ amount number(11) default null,
43
+ constraint tariffs_pk primary key (tariff_id, start_date)
44
+ );
45
+
46
+ create table product_tariffs (
47
+ product_id number(11),
48
+ tariff_id number(11),
49
+ tariff_start_date date,
50
+ constraint product_tariffs_pk primary key (product_id, tariff_id, tariff_start_date)
51
+ );
52
+
53
+ create table suburbs (
54
+ city_id number(11),
55
+ suburb_id number(11),
56
+ name varchar2(50) not null,
57
+ constraint suburbs_pk primary key (city_id, suburb_id)
58
+ );
59
+
60
+ create sequence streets_seq start with 1000;
61
+
62
+ create table streets (
63
+ id number(11) primary key,
64
+ city_id number(11) not null,
65
+ suburb_id number(11) not null,
66
+ name varchar2(50) not null
67
+ );
68
+
69
+ create sequence users_seq start with 1000;
70
+
71
+ create table users (
72
+ id number(11) primary key,
73
+ name varchar2(50) not null
74
+ );
75
+
76
+ create sequence articles_seq start with 1000;
77
+
78
+ create table articles (
79
+ id number(11) primary key,
80
+ name varchar2(50) not null
81
+ );
82
+
83
+ create sequence readings_seq start with 1000;
84
+
85
+ create table readings (
86
+ id number(11) primary key,
87
+ user_id number(11) not null,
88
+ article_id number(11) not null,
89
+ rating number(11) not null
90
+ );
91
+
92
+ create sequence groups_seq start with 1000;
93
+
94
+ create table groups (
95
+ id number(11) primary key,
96
+ name varchar2(50) not null
97
+ );
98
+
99
+ create table memberships (
100
+ user_id number(11) not null,
101
+ group_id number(11) not null,
102
+ constraint memberships_pk primary key (user_id, group_id)
103
+ );
104
+
105
+ create sequence membership_statuses_seq start with 1000;
106
+
107
+ create table membership_statuses (
108
+ id number(11) primary key,
109
+ user_id number(11) not null,
110
+ group_id number(11) not null,
111
+ status varchar2(50) not null
112
+ );
113
+
114
+ create table departments (
115
+ department_id number(11) not null,
116
+ location_id number(11) not null,
117
+ constraint departments_pk primary key (department_id, location_id)
118
+ );
119
+
120
+ create sequence employees_seq start with 1000;
121
+
122
+ create table employees (
123
+ id number(11) not null primary key,
124
+ department_id number(11) default null,
125
+ location_id number(11) default null
126
+ );
127
+
128
+ create sequence comments_seq start with 1000;
129
+
130
+ create table comments (
131
+ id number(11) not null primary key,
132
+ person_id number(11) default null,
133
+ shown number(11) default null,
134
+ person_type varchar(100) default null,
135
+ hack_id number(11) default null
136
+ );
137
+
138
+ create sequence hacks_seq start with 1000;
139
+
140
+ create table hacks (
141
+ id number(11) not null primary key,
142
+ name varchar(50) not null
143
+ );
144
+
145
+ create table restaurants (
146
+ franchise_id number(11) not null,
147
+ store_id number(11) not null,
148
+ name varchar(100),
149
+ lock_version number(11) default 0,
150
+ constraint restaurants_pk primary key (franchise_id, store_id)
151
+ );
152
+
153
+ create table restaurants_suburbs (
154
+ franchise_id number(11) not null,
155
+ store_id number(11) not null,
156
+ city_id number(11) not null,
157
+ suburb_id number(11) not null
158
+ );
159
+
160
+ create sequence dorms_seq start with 1000;
161
+
162
+ create table dorms (
163
+ id number(11) not null,
164
+ constraint dorms_pk primary key (id)
165
+ );
166
+
167
+ create table rooms (
168
+ dorm_id number(11) not null,
169
+ room_id number(11) not null,
170
+ constraint rooms_pk primary key (dorm_id, room_id)
171
+ );
172
+
173
+ create sequence room_attributes_seq start with 1000;
174
+
175
+ create table room_attributes (
176
+ id number(11) not null,
177
+ name varchar(50),
178
+ constraint room_attributes_pk primary key (id)
179
+ );
180
+
181
+ create table room_attribute_assignments (
182
+ dorm_id number(11) not null,
183
+ room_id number(11) not null,
184
+ room_attribute_id number(11) not null
185
+ );
186
+
187
+ create sequence students_seq start with 1000;
188
+
189
+ create table students (
190
+ id number(11) not null,
191
+ constraint students_pk primary key (id)
192
+ );
193
+
194
+ create table room_assignments (
195
+ student_id number(11) not null,
196
+ dorm_id number(11) not null,
197
+ room_id number(11) not null
198
+ );
199
+
200
+ create table seats (
201
+ flight_number int not null,
202
+ seat int not null,
203
+ customer int,
204
+ primary key (flight_number, seat)
205
+ );
206
+
207
+ create table capitols (
208
+ country varchar2(2000) not null,
209
+ city varchar2(2000) not null,
210
+ primary key (country, city)
211
+ );
212
+
213
+ create table products_restaurants (
214
+ product_id number(11) not null,
215
+ franchise_id number(11) not null,
216
+ store_id number(11) not null
217
+ );
218
+
219
+ create table employees_groups (
220
+ employee_id int not null,
221
+ group_id int not null
222
+ );
223
+