composite_primary_keys 12.0.2 → 12.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.rdoc +880 -841
- data/README.rdoc +180 -179
- data/lib/composite_primary_keys/active_model/attribute_assignment.rb +19 -0
- data/lib/composite_primary_keys/arel/sqlserver.rb +1 -3
- data/lib/composite_primary_keys/associations/association_scope.rb +68 -68
- data/lib/composite_primary_keys/associations/join_dependency.rb +103 -103
- data/lib/composite_primary_keys/associations/through_association.rb +2 -1
- data/lib/composite_primary_keys/attribute_methods/primary_key.rb +13 -0
- data/lib/composite_primary_keys/attribute_methods/read.rb +30 -30
- data/lib/composite_primary_keys/attribute_methods/write.rb +35 -35
- data/lib/composite_primary_keys/attribute_methods.rb +9 -9
- data/lib/composite_primary_keys/base.rb +141 -130
- data/lib/composite_primary_keys/composite_arrays.rb +0 -8
- data/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb +37 -17
- data/lib/composite_primary_keys/connection_adapters/sqlserver/database_statements.rb +44 -23
- data/lib/composite_primary_keys/core.rb +48 -48
- data/lib/composite_primary_keys/persistence.rb +82 -81
- data/lib/composite_primary_keys/reflection.rb +29 -29
- data/lib/composite_primary_keys/relation/batches.rb +1 -1
- data/lib/composite_primary_keys/relation/calculations.rb +81 -81
- data/lib/composite_primary_keys/relation/finder_methods.rb +235 -235
- data/lib/composite_primary_keys/relation/predicate_builder/association_query_value.rb +20 -20
- data/lib/composite_primary_keys/relation/query_methods.rb +42 -42
- data/lib/composite_primary_keys/relation/where_clause.rb +23 -23
- data/lib/composite_primary_keys/relation.rb +193 -118
- data/lib/composite_primary_keys/version.rb +8 -8
- data/lib/composite_primary_keys.rb +117 -118
- data/test/abstract_unit.rb +114 -113
- data/test/connections/databases.ci.yml +22 -19
- data/test/fixtures/article.rb +4 -0
- data/test/fixtures/articles.yml +4 -3
- data/test/fixtures/comment.rb +1 -3
- data/test/fixtures/comments.yml +10 -9
- data/test/fixtures/db_definitions/db2-create-tables.sql +112 -126
- data/test/fixtures/db_definitions/db2-drop-tables.sql +17 -19
- data/test/fixtures/db_definitions/mysql.sql +180 -217
- data/test/fixtures/db_definitions/oracle.drop.sql +42 -48
- data/test/fixtures/db_definitions/oracle.sql +200 -236
- data/test/fixtures/db_definitions/postgresql.sql +183 -220
- data/test/fixtures/db_definitions/sqlite.sql +170 -206
- data/test/fixtures/db_definitions/sqlserver.sql +176 -212
- data/test/fixtures/department.rb +16 -11
- data/test/fixtures/departments.yml +15 -15
- data/test/fixtures/employees.yml +27 -27
- data/test/fixtures/readings.yml +2 -2
- data/test/fixtures/restaurants_suburbs.yml +11 -11
- data/test/fixtures/streets.yml +16 -16
- data/test/fixtures/suburbs.yml +14 -14
- data/test/fixtures/user.rb +11 -10
- data/test/test_associations.rb +358 -351
- data/test/test_attributes.rb +60 -60
- data/test/test_calculations.rb +42 -42
- data/test/test_create.rb +218 -183
- data/test/test_delete.rb +182 -179
- data/test/test_exists.rb +39 -39
- data/test/test_find.rb +164 -145
- data/test/test_habtm.rb +2 -2
- data/test/test_ids.rb +112 -116
- data/test/test_nested_attributes.rb +67 -124
- data/test/test_polymorphic.rb +29 -13
- data/test/test_preload.rb +4 -3
- data/test/test_serialize.rb +2 -2
- data/test/test_update.rb +96 -78
- metadata +4 -19
- data/test/fixtures/hack.rb +0 -5
- data/test/fixtures/hacks.yml +0 -3
- data/test/fixtures/pk_called_id.rb +0 -5
- data/test/fixtures/pk_called_ids.yml +0 -11
- data/test/fixtures/reference_code_using_composite_key_alias.rb +0 -8
- data/test/fixtures/reference_code_using_simple_key_alias.rb +0 -8
- data/test/fixtures/seat.rb +0 -5
- data/test/fixtures/seats.yml +0 -9
- data/test/fixtures/topic.rb +0 -6
- data/test/fixtures/topic_source.rb +0 -7
- data/test/test_aliases.rb +0 -18
- data/test/test_enum.rb +0 -21
- data/test/test_suite.rb +0 -35
@@ -1,206 +1,170 @@
|
|
1
|
-
create table
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
);
|
7
|
-
|
8
|
-
create table
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
primary key (
|
45
|
-
);
|
46
|
-
|
47
|
-
create table
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
);
|
53
|
-
|
54
|
-
create table
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
);
|
108
|
-
|
109
|
-
create table
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
);
|
123
|
-
|
124
|
-
create table
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
dorm_id integer not null,
|
172
|
-
room_id integer not null
|
173
|
-
);
|
174
|
-
|
175
|
-
create table seats (
|
176
|
-
flight_number integer not_null,
|
177
|
-
seat integer not_null,
|
178
|
-
customer integer,
|
179
|
-
primary key (flight_number, seat)
|
180
|
-
);
|
181
|
-
|
182
|
-
create table capitols (
|
183
|
-
country text not null,
|
184
|
-
city text not null,
|
185
|
-
primary key (country, city)
|
186
|
-
);
|
187
|
-
|
188
|
-
create table products_restaurants (
|
189
|
-
product_id integer not null,
|
190
|
-
franchise_id integer not null,
|
191
|
-
store_id integer not null
|
192
|
-
);
|
193
|
-
|
194
|
-
create table employees_groups (
|
195
|
-
employee_id integer not null,
|
196
|
-
group_id integer not null
|
197
|
-
);
|
198
|
-
|
199
|
-
create table pk_called_ids (
|
200
|
-
id integer not null,
|
201
|
-
reference_code int not null,
|
202
|
-
code_label varchar(50) default null,
|
203
|
-
abbreviation varchar(50) default null,
|
204
|
-
description varchar(50) default null,
|
205
|
-
primary key (id, reference_code)
|
206
|
-
);
|
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 articles (
|
60
|
+
id integer not null primary key autoincrement,
|
61
|
+
name varchar(50) not null
|
62
|
+
);
|
63
|
+
|
64
|
+
create table readings (
|
65
|
+
id integer not null primary key autoincrement,
|
66
|
+
user_id int not null,
|
67
|
+
article_id int not null,
|
68
|
+
rating int not null
|
69
|
+
);
|
70
|
+
|
71
|
+
create table groups (
|
72
|
+
id integer not null primary key autoincrement,
|
73
|
+
name varchar(50) not null
|
74
|
+
);
|
75
|
+
|
76
|
+
create table memberships (
|
77
|
+
user_id int not null,
|
78
|
+
group_id int not null,
|
79
|
+
primary key (user_id, group_id)
|
80
|
+
);
|
81
|
+
|
82
|
+
create table membership_statuses (
|
83
|
+
id integer not null primary key autoincrement,
|
84
|
+
user_id int not null,
|
85
|
+
group_id int not null,
|
86
|
+
status varchar(50) not null
|
87
|
+
);
|
88
|
+
|
89
|
+
create table departments (
|
90
|
+
id integer not null,
|
91
|
+
location_id integer not null,
|
92
|
+
primary key (id, location_id)
|
93
|
+
);
|
94
|
+
|
95
|
+
create table employees (
|
96
|
+
id integer not null primary key autoincrement,
|
97
|
+
department_id integer null,
|
98
|
+
location_id integer null,
|
99
|
+
name varchar(50) not null
|
100
|
+
);
|
101
|
+
|
102
|
+
create table comments (
|
103
|
+
id integer not null primary key autoincrement,
|
104
|
+
article_id int not null,
|
105
|
+
person_id int not null,
|
106
|
+
person_type varchar(100) not null
|
107
|
+
);
|
108
|
+
|
109
|
+
create table restaurants (
|
110
|
+
franchise_id integer not null,
|
111
|
+
store_id integer not null,
|
112
|
+
name varchar(100),
|
113
|
+
lock_version integer default 0,
|
114
|
+
primary key (franchise_id, store_id)
|
115
|
+
);
|
116
|
+
|
117
|
+
create table restaurants_suburbs (
|
118
|
+
franchise_id integer not null,
|
119
|
+
store_id integer not null,
|
120
|
+
city_id integer not null,
|
121
|
+
suburb_id integer not null
|
122
|
+
);
|
123
|
+
|
124
|
+
create table dorms (
|
125
|
+
id integer not null primary key autoincrement
|
126
|
+
);
|
127
|
+
|
128
|
+
create table rooms (
|
129
|
+
dorm_id integer not null,
|
130
|
+
room_id integer not null,
|
131
|
+
primary key (dorm_id, room_id)
|
132
|
+
);
|
133
|
+
|
134
|
+
create table room_attributes (
|
135
|
+
id integer not null primary key autoincrement,
|
136
|
+
name varchar(50)
|
137
|
+
);
|
138
|
+
|
139
|
+
create table room_attribute_assignments (
|
140
|
+
dorm_id integer not null,
|
141
|
+
room_id integer not null,
|
142
|
+
room_attribute_id integer not null
|
143
|
+
);
|
144
|
+
|
145
|
+
create table students (
|
146
|
+
id integer not null primary key autoincrement
|
147
|
+
);
|
148
|
+
|
149
|
+
create table room_assignments (
|
150
|
+
student_id integer not null,
|
151
|
+
dorm_id integer not null,
|
152
|
+
room_id integer not null
|
153
|
+
);
|
154
|
+
|
155
|
+
create table capitols (
|
156
|
+
country text not null,
|
157
|
+
city text not null,
|
158
|
+
primary key (country, city)
|
159
|
+
);
|
160
|
+
|
161
|
+
create table products_restaurants (
|
162
|
+
product_id integer not null,
|
163
|
+
franchise_id integer not null,
|
164
|
+
store_id integer not null
|
165
|
+
);
|
166
|
+
|
167
|
+
create table employees_groups (
|
168
|
+
employee_id integer not null,
|
169
|
+
group_id integer not null
|
170
|
+
);
|