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,191 +1,191 @@
1
- create table reference_types (
2
- reference_type_id integer primary key,
3
- type_label varchar(50) default null,
4
- abbreviation varchar(50) default null,
5
- description varchar(50) default null
6
- );
7
-
8
- create table reference_codes (
9
- reference_type_id int,
10
- reference_code int not null,
11
- code_label varchar(50) default null,
12
- abbreviation varchar(50) default null,
13
- description varchar(50) default null,
14
- primary key (reference_type_id, reference_code)
15
- );
16
-
17
- create table products (
18
- id int not null primary key,
19
- name varchar(50) default null,
20
- created_at TIMESTAMP,
21
- updated_at TIMESTAMP
22
- );
23
-
24
- create table tariffs (
25
- tariff_id int not null,
26
- start_date date not null,
27
- amount integer(11) default null,
28
- created_at TIMESTAMP,
29
- updated_at TIMESTAMP,
30
- primary key (tariff_id, start_date)
31
- );
32
-
33
- create table product_tariffs (
34
- product_id int not null,
35
- tariff_id int not null,
36
- tariff_start_date date not null,
37
- primary key (product_id, tariff_id, tariff_start_date)
38
- );
39
-
40
- create table suburbs (
41
- city_id int identity(1,1) not null,
42
- suburb_id int identity(1,1) not null,
43
- name varchar(50) not null,
44
- primary key (city_id, suburb_id)
45
- );
46
-
47
- create table streets (
48
- id integer not null primary key autoincrement,
49
- city_id int not null,
50
- suburb_id int not null,
51
- name varchar(50) not null
52
- );
53
-
54
- create table users (
55
- id integer not null primary key autoincrement,
56
- name varchar(50) not null
57
- );
58
-
59
- create table moderators (
60
- id integer not null primary key
61
- );
62
-
63
- create table admins (
64
- id integer not null primary key
65
- );
66
-
67
- create table articles (
68
- id integer not null primary key autoincrement,
69
- name varchar(50) not null
70
- );
71
-
72
- create table readings (
73
- id integer not null primary key autoincrement,
74
- user_id int not null,
75
- article_id int not null,
76
- rating int not null
77
- );
78
-
79
- create table groups (
80
- id integer not null primary key autoincrement,
81
- name varchar(50) not null
82
- );
83
-
84
- create table memberships (
85
- user_id int not null,
86
- group_id int not null,
87
- primary key (user_id, group_id)
88
- );
89
-
90
- create table membership_statuses (
91
- id integer not null primary key autoincrement,
92
- user_id int not null,
93
- group_id int not null,
94
- status varchar(50) not null
95
- );
96
-
97
- create table departments (
98
- id integer not null,
99
- location_id integer not null,
100
- primary key (id, location_id)
101
- );
102
-
103
- create table employees (
104
- id integer not null primary key autoincrement,
105
- department_id integer null,
106
- location_id integer null,
107
- name varchar(50) not null
108
- );
109
-
110
- create table comments (
111
- id integer not null primary key autoincrement,
112
- article_id int not null,
113
- person_id int not null,
114
- person_type varchar(100) not null
115
- );
116
-
117
- create table restaurants (
118
- franchise_id integer not null,
119
- store_id integer not null,
120
- name varchar(100),
121
- lock_version integer default 0,
122
- primary key (franchise_id, store_id)
123
- );
124
-
125
- create table restaurants_suburbs (
126
- franchise_id integer not null,
127
- store_id integer not null,
128
- city_id integer not null,
129
- suburb_id integer not null
130
- );
131
-
132
- create table dorms (
133
- id integer not null primary key autoincrement
134
- );
135
-
136
- create table rooms (
137
- dorm_id integer not null,
138
- room_id integer not null,
139
- primary key (dorm_id, room_id)
140
- );
141
-
142
- create table room_attributes (
143
- id integer not null primary key autoincrement,
144
- name varchar(50)
145
- );
146
-
147
- create table room_attribute_assignments (
148
- dorm_id integer not null,
149
- room_id integer not null,
150
- room_attribute_id integer not null
151
- );
152
-
153
- create table staff_rooms (
154
- dorm_id integer not null,
155
- room_id integer not null,
156
- primary key (dorm_id, room_id)
157
- );
158
-
159
- create table staff_room_keys (
160
- dorm_id integer not null,
161
- room_id integer not null,
162
- key_no varchar(50) not null,
163
- primary key (dorm_id, room_id)
164
- );
165
-
166
- create table students (
167
- id integer not null primary key autoincrement
168
- );
169
-
170
- create table room_assignments (
171
- student_id integer not null,
172
- dorm_id integer not null,
173
- room_id integer not null
174
- );
175
-
176
- create table capitols (
177
- country text not null,
178
- city text not null,
179
- primary key (country, city)
180
- );
181
-
182
- create table products_restaurants (
183
- product_id integer not null,
184
- franchise_id integer not null,
185
- store_id integer not null
186
- );
187
-
188
- create table employees_groups (
189
- employee_id integer not null,
190
- group_id integer not null
1
+ create table reference_types (
2
+ reference_type_id integer primary key,
3
+ type_label varchar(50) default null,
4
+ abbreviation varchar(50) default null,
5
+ description varchar(50) default null
6
+ );
7
+
8
+ create table reference_codes (
9
+ reference_type_id int,
10
+ reference_code int not null,
11
+ code_label varchar(50) default null,
12
+ abbreviation varchar(50) default null,
13
+ description varchar(50) default null,
14
+ primary key (reference_type_id, reference_code)
15
+ );
16
+
17
+ create table products (
18
+ id int not null primary key,
19
+ name varchar(50) default null,
20
+ created_at TIMESTAMP,
21
+ updated_at TIMESTAMP
22
+ );
23
+
24
+ create table tariffs (
25
+ tariff_id int not null,
26
+ start_date date not null,
27
+ amount integer(11) default null,
28
+ created_at TIMESTAMP,
29
+ updated_at TIMESTAMP,
30
+ primary key (tariff_id, start_date)
31
+ );
32
+
33
+ create table product_tariffs (
34
+ product_id int not null,
35
+ tariff_id int not null,
36
+ tariff_start_date date not null,
37
+ primary key (product_id, tariff_id, tariff_start_date)
38
+ );
39
+
40
+ create table suburbs (
41
+ city_id int identity(1,1) not null,
42
+ suburb_id int identity(1,1) not null,
43
+ name varchar(50) not null,
44
+ primary key (city_id, suburb_id)
45
+ );
46
+
47
+ create table streets (
48
+ id integer not null primary key autoincrement,
49
+ city_id int not null,
50
+ suburb_id int not null,
51
+ name varchar(50) not null
52
+ );
53
+
54
+ create table users (
55
+ id integer not null primary key autoincrement,
56
+ name varchar(50) not null
57
+ );
58
+
59
+ create table moderators (
60
+ id integer not null primary key
61
+ );
62
+
63
+ create table admins (
64
+ id integer not null primary key
65
+ );
66
+
67
+ create table articles (
68
+ id integer not null primary key autoincrement,
69
+ name varchar(50) not null
70
+ );
71
+
72
+ create table readings (
73
+ id integer not null primary key autoincrement,
74
+ user_id int not null,
75
+ article_id int not null,
76
+ rating int not null
77
+ );
78
+
79
+ create table groups (
80
+ id integer not null primary key autoincrement,
81
+ name varchar(50) not null
82
+ );
83
+
84
+ create table memberships (
85
+ user_id int not null,
86
+ group_id int not null,
87
+ primary key (user_id, group_id)
88
+ );
89
+
90
+ create table membership_statuses (
91
+ id integer not null primary key autoincrement,
92
+ user_id int not null,
93
+ group_id int not null,
94
+ status varchar(50) not null
95
+ );
96
+
97
+ create table departments (
98
+ id integer not null,
99
+ location_id integer not null,
100
+ primary key (id, location_id)
101
+ );
102
+
103
+ create table employees (
104
+ id integer not null primary key autoincrement,
105
+ department_id integer null,
106
+ location_id integer null,
107
+ name varchar(50) not null
108
+ );
109
+
110
+ create table comments (
111
+ id integer not null primary key autoincrement,
112
+ article_id int not null,
113
+ person_id int not null,
114
+ person_type varchar(100) not null
115
+ );
116
+
117
+ create table restaurants (
118
+ franchise_id integer not null,
119
+ store_id integer not null,
120
+ name varchar(100),
121
+ lock_version integer default 0,
122
+ primary key (franchise_id, store_id)
123
+ );
124
+
125
+ create table restaurants_suburbs (
126
+ franchise_id integer not null,
127
+ store_id integer not null,
128
+ city_id integer not null,
129
+ suburb_id integer not null
130
+ );
131
+
132
+ create table dorms (
133
+ id integer not null primary key autoincrement
134
+ );
135
+
136
+ create table rooms (
137
+ dorm_id integer not null,
138
+ room_id integer not null,
139
+ primary key (dorm_id, room_id)
140
+ );
141
+
142
+ create table room_attributes (
143
+ id integer not null primary key autoincrement,
144
+ name varchar(50)
145
+ );
146
+
147
+ create table room_attribute_assignments (
148
+ dorm_id integer not null,
149
+ room_id integer not null,
150
+ room_attribute_id integer not null
151
+ );
152
+
153
+ create table staff_rooms (
154
+ dorm_id integer not null,
155
+ room_id integer not null,
156
+ primary key (dorm_id, room_id)
157
+ );
158
+
159
+ create table staff_room_keys (
160
+ dorm_id integer not null,
161
+ room_id integer not null,
162
+ key_no varchar(50) not null,
163
+ primary key (dorm_id, room_id)
164
+ );
165
+
166
+ create table students (
167
+ id integer not null primary key autoincrement
168
+ );
169
+
170
+ create table room_assignments (
171
+ student_id integer not null,
172
+ dorm_id integer not null,
173
+ room_id integer not null
174
+ );
175
+
176
+ create table capitols (
177
+ country text not null,
178
+ city text not null,
179
+ primary key (country, city)
180
+ );
181
+
182
+ create table products_restaurants (
183
+ product_id integer not null,
184
+ franchise_id integer not null,
185
+ store_id integer not null
186
+ );
187
+
188
+ create table employees_groups (
189
+ employee_id integer not null,
190
+ group_id integer not null
191
191
  );