Przeglądaj źródła

fix mssql tests

Maurits van der Schee 5 lat temu
rodzic
commit
1a1200a1ba

+ 29
- 9
api.php Wyświetl plik

@@ -2178,7 +2178,7 @@ class GenericDefinition
2178 2178
                 return "ALTER TABLE $p1 $p4";
2179 2179
             case 'pgsql':
2180 2180
             case 'sqlsrv':
2181
-                $p4 = $newColumn->getPk() ? "ADD PRIMARY KEY ($p2)" : "DROP CONSTRAINT $p3";
2181
+                $p4 = $newColumn->getPk() ? "ADD CONSTRAINT $p3 PRIMARY KEY ($p2)" : "DROP CONSTRAINT $p3";
2182 2182
                 return "ALTER TABLE $p1 $p4";
2183 2183
         }
2184 2184
     }
@@ -2203,15 +2203,17 @@ class GenericDefinition
2203 2203
     {
2204 2204
         $p1 = $this->quote($tableName);
2205 2205
         $p2 = $this->quote($columnName);
2206
-        $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
2207
-
2206
+        
2208 2207
         switch ($this->driver) {
2209 2208
             case 'mysql':
2210 2209
                 return "select 1";
2211 2210
             case 'pgsql':
2211
+                $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
2212 2212
                 return "SELECT setval($p3, (SELECT max($p2)+1 FROM $p1));";
2213 2213
             case 'sqlsrv':
2214
-                return "ALTER SEQUENCE $p3 RESTART WITH (SELECT max($p2)+1 FROM $p1)";
2214
+                $p3 = $this->quote($tableName . '_' . $columnName . '_seq');
2215
+                $p4 = $this->pdo->query("SELECT max($p2)+1 FROM $p1")->fetchColumn();
2216
+                return "ALTER SEQUENCE $p3 RESTART WITH $p4";
2215 2217
         }
2216 2218
     }
2217 2219
 
@@ -2234,8 +2236,8 @@ class GenericDefinition
2234 2236
                 }
2235 2237
                 return "ALTER TABLE $p1 ALTER COLUMN $p2 $p4";
2236 2238
             case 'sqlsrv':
2237
-                $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
2238
-                $p4 = $this->quote('DF_' . $tableName . '_' . $columnName);
2239
+                $p3 = $this->quote($tableName . '_' . $columnName . '_seq');
2240
+                $p4 = $this->quote($tableName . '_' . $columnName . '_def');
2239 2241
                 if ($newColumn->getPk()) {
2240 2242
                     return "ALTER TABLE $p1 ADD CONSTRAINT $p4 DEFAULT NEXT VALUE FOR $p3 FOR $p2";
2241 2243
                 } else {
@@ -2301,14 +2303,26 @@ class GenericDefinition
2301 2303
         $p2 = $this->quote($newColumn->getName());
2302 2304
         $p3 = $this->getColumnType($newColumn, false);
2303 2305
 
2304
-        return "ALTER TABLE $p1 ADD COLUMN $p2 $p3";
2306
+        switch ($this->driver) {
2307
+            case 'mysql':
2308
+            case 'pgsql':
2309
+                return "ALTER TABLE $p1 ADD COLUMN $p2 $p3";
2310
+            case 'sqlsrv':
2311
+                return "ALTER TABLE $p1 ADD $p2 $p3";
2312
+        }
2305 2313
     }
2306 2314
 
2307 2315
     private function getRemoveTableSQL(String $tableName): String
2308 2316
     {
2309 2317
         $p1 = $this->quote($tableName);
2310 2318
 
2311
-        return "DROP TABLE $p1 CASCADE;";
2319
+        switch ($this->driver) {
2320
+            case 'mysql':
2321
+            case 'pgsql':
2322
+                return "DROP TABLE $p1 CASCADE;";
2323
+            case 'sqlsrv':
2324
+                return "DROP TABLE $p1;";
2325
+        }
2312 2326
     }
2313 2327
 
2314 2328
     private function getRemoveColumnSQL(String $tableName, String $columnName): String
@@ -2316,7 +2330,13 @@ class GenericDefinition
2316 2330
         $p1 = $this->quote($tableName);
2317 2331
         $p2 = $this->quote($columnName);
2318 2332
 
2319
-        return "ALTER TABLE $p1 DROP COLUMN $p2 CASCADE;";
2333
+        switch ($this->driver) {
2334
+            case 'mysql':
2335
+            case 'pgsql':
2336
+                return "ALTER TABLE $p1 DROP COLUMN $p2 CASCADE;";
2337
+            case 'sqlsrv':
2338
+                return "ALTER TABLE $p1 DROP COLUMN $p2;";
2339
+        }
2320 2340
     }
2321 2341
 
2322 2342
     public function renameTable(String $tableName, String $newTableName)

+ 31
- 9
src/Tqdev/PhpCrudApi/Database/GenericDefinition.php Wyświetl plik

@@ -163,7 +163,7 @@ class GenericDefinition
163 163
                 return "ALTER TABLE $p1 $p4";
164 164
             case 'pgsql':
165 165
             case 'sqlsrv':
166
-                $p4 = $newColumn->getPk() ? "ADD PRIMARY KEY ($p2)" : "DROP CONSTRAINT $p3";
166
+                $p4 = $newColumn->getPk() ? "ADD CONSTRAINT $p3 PRIMARY KEY ($p2)" : "DROP CONSTRAINT $p3";
167 167
                 return "ALTER TABLE $p1 $p4";
168 168
         }
169 169
     }
@@ -188,15 +188,17 @@ class GenericDefinition
188 188
     {
189 189
         $p1 = $this->quote($tableName);
190 190
         $p2 = $this->quote($columnName);
191
-        $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
192
-
191
+        
193 192
         switch ($this->driver) {
194 193
             case 'mysql':
195 194
                 return "select 1";
196 195
             case 'pgsql':
196
+                $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
197 197
                 return "SELECT setval($p3, (SELECT max($p2)+1 FROM $p1));";
198 198
             case 'sqlsrv':
199
-                return "ALTER SEQUENCE $p3 RESTART WITH (SELECT max($p2)+1 FROM $p1)";
199
+                $p3 = $this->quote($tableName . '_' . $columnName . '_seq');
200
+                $p4 = $this->pdo->query("SELECT max($p2)+1 FROM $p1")->fetchColumn();
201
+                return "ALTER SEQUENCE $p3 RESTART WITH $p4";
200 202
         }
201 203
     }
202 204
 
@@ -219,8 +221,8 @@ class GenericDefinition
219 221
                 }
220 222
                 return "ALTER TABLE $p1 ALTER COLUMN $p2 $p4";
221 223
             case 'sqlsrv':
222
-                $p3 = $this->pdo->quote($tableName . '_' . $columnName . '_seq');
223
-                $p4 = $this->quote('DF_' . $tableName . '_' . $columnName);
224
+                $p3 = $this->quote($tableName . '_' . $columnName . '_seq');
225
+                $p4 = $this->quote($tableName . '_' . $columnName . '_def');
224 226
                 if ($newColumn->getPk()) {
225 227
                     return "ALTER TABLE $p1 ADD CONSTRAINT $p4 DEFAULT NEXT VALUE FOR $p3 FOR $p2";
226 228
                 } else {
@@ -286,14 +288,27 @@ class GenericDefinition
286 288
         $p2 = $this->quote($newColumn->getName());
287 289
         $p3 = $this->getColumnType($newColumn, false);
288 290
 
289
-        return "ALTER TABLE $p1 ADD COLUMN $p2 $p3";
291
+        
292
+        switch ($this->driver) {
293
+            case 'mysql':
294
+            case 'pgsql':
295
+                return "ALTER TABLE $p1 ADD COLUMN $p2 $p3";
296
+            case 'sqlsrv':
297
+                return "ALTER TABLE $p1 ADD $p2 $p3";
298
+        }
290 299
     }
291 300
 
292 301
     private function getRemoveTableSQL(String $tableName): String
293 302
     {
294 303
         $p1 = $this->quote($tableName);
295 304
 
296
-        return "DROP TABLE $p1 CASCADE;";
305
+        switch ($this->driver) {
306
+            case 'mysql':
307
+            case 'pgsql':
308
+                return "DROP TABLE $p1 CASCADE;";
309
+            case 'sqlsrv':
310
+                return "DROP TABLE $p1;";
311
+        }
297 312
     }
298 313
 
299 314
     private function getRemoveColumnSQL(String $tableName, String $columnName): String
@@ -301,7 +316,14 @@ class GenericDefinition
301 316
         $p1 = $this->quote($tableName);
302 317
         $p2 = $this->quote($columnName);
303 318
 
304
-        return "ALTER TABLE $p1 DROP COLUMN $p2 CASCADE;";
319
+        
320
+        switch ($this->driver) {
321
+            case 'mysql':
322
+            case 'pgsql':
323
+                return "ALTER TABLE $p1 DROP COLUMN $p2 CASCADE;";
324
+            case 'sqlsrv':
325
+                return "ALTER TABLE $p1 DROP COLUMN $p2;";
326
+        }
305 327
     }
306 328
 
307 329
     public function renameTable(String $tableName, String $newTableName)

+ 104
- 61
tests/fixtures/blog_sqlsrv.sql Wyświetl plik

@@ -1,48 +1,48 @@
1
-IF (OBJECT_ID('FK_kunsthåndværk_users', 'F') IS NOT NULL)
1
+IF (OBJECT_ID('kunsthåndværk_user_id_fkey', 'F') IS NOT NULL)
2 2
 BEGIN
3
-ALTER TABLE [kunsthåndværk] DROP	CONSTRAINT [FK_kunsthåndværk_users]
3
+ALTER TABLE [kunsthåndværk] DROP	CONSTRAINT [kunsthåndværk_user_id_fkey]
4 4
 END
5 5
 GO
6 6
 
7
-IF (OBJECT_ID('FK_barcodes_products', 'F') IS NOT NULL)
7
+IF (OBJECT_ID('barcodes_product_id_fkey', 'F') IS NOT NULL)
8 8
 BEGIN
9
-ALTER TABLE [barcodes] DROP	CONSTRAINT [FK_barcodes_products]
9
+ALTER TABLE [barcodes] DROP	CONSTRAINT [barcodes_product_id_fkey]
10 10
 END
11 11
 GO
12 12
 
13
-IF (OBJECT_ID('FK_posts_users', 'F') IS NOT NULL)
13
+IF (OBJECT_ID('posts_user_id_fkey', 'F') IS NOT NULL)
14 14
 BEGIN
15
-ALTER TABLE [posts] DROP	CONSTRAINT [FK_posts_users]
15
+ALTER TABLE [posts] DROP	CONSTRAINT [posts_user_id_fkey]
16 16
 END
17 17
 GO
18 18
 
19
-IF (OBJECT_ID('FK_posts_categories', 'F') IS NOT NULL)
19
+IF (OBJECT_ID('posts_category_id_fkey', 'F') IS NOT NULL)
20 20
 BEGIN
21
-ALTER TABLE [posts] DROP	CONSTRAINT [FK_posts_categories]
21
+ALTER TABLE [posts] DROP	CONSTRAINT [posts_category_id_fkey]
22 22
 END
23 23
 GO
24 24
 
25
-IF (OBJECT_ID('FK_post_tags_tags', 'F') IS NOT NULL)
25
+IF (OBJECT_ID('post_tags_tag_id_fkey', 'F') IS NOT NULL)
26 26
 BEGIN
27
-ALTER TABLE [post_tags] DROP	CONSTRAINT [FK_post_tags_tags]
27
+ALTER TABLE [post_tags] DROP	CONSTRAINT [post_tags_tag_id_fkey]
28 28
 END
29 29
 GO
30 30
 
31
-IF (OBJECT_ID('FK_post_tags_posts', 'F') IS NOT NULL)
31
+IF (OBJECT_ID('post_tags_post_id_fkey', 'F') IS NOT NULL)
32 32
 BEGIN
33
-ALTER TABLE [post_tags] DROP	CONSTRAINT [FK_post_tags_posts]
33
+ALTER TABLE [post_tags] DROP	CONSTRAINT [post_tags_post_id_fkey]
34 34
 END
35 35
 GO
36 36
 
37
-IF (OBJECT_ID('FK_comments_posts', 'F') IS NOT NULL)
37
+IF (OBJECT_ID('comments_post_id_fkey', 'F') IS NOT NULL)
38 38
 BEGIN
39
-ALTER TABLE [comments] DROP	CONSTRAINT [FK_comments_posts]
39
+ALTER TABLE [comments] DROP	CONSTRAINT [comments_post_id_fkey]
40 40
 END
41 41
 GO
42 42
 
43
-IF (OBJECT_ID('FK_comments_categories', 'F') IS NOT NULL)
43
+IF (OBJECT_ID('comments_category_id_fkey', 'F') IS NOT NULL)
44 44
 BEGIN
45
-ALTER TABLE [comments] DROP	CONSTRAINT [FK_comments_categories]
45
+ALTER TABLE [comments] DROP	CONSTRAINT [comments_category_id_fkey]
46 46
 END
47 47
 GO
48 48
 
@@ -136,74 +136,111 @@ DROP TABLE [nopk]
136 136
 END
137 137
 GO
138 138
 
139
+DROP SEQUENCE IF EXISTS [categories_id_seq]
140
+GO
141
+CREATE SEQUENCE [categories_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
142
+GO
143
+
139 144
 CREATE TABLE [categories](
140
-	[id] [int] IDENTITY,
145
+	[id] [int] NOT NULL CONSTRAINT [categories_id_def] DEFAULT NEXT VALUE FOR [categories_id_seq],
141 146
 	[name] [nvarchar](255) NOT NULL,
142 147
 	[icon] [image],
143
-	PRIMARY KEY CLUSTERED([id] ASC)
148
+	CONSTRAINT [categories_pkey] PRIMARY KEY CLUSTERED([id] ASC)
144 149
 )
145 150
 GO
146 151
 
152
+DROP SEQUENCE IF EXISTS [comments_id_seq]
153
+GO
154
+CREATE SEQUENCE [comments_id_seq] AS bigint START WITH 1 INCREMENT BY 1 NO CACHE
155
+GO
156
+
147 157
 CREATE TABLE [comments](
148
-	[id] [bigint] IDENTITY,
158
+	[id] [bigint] NOT NULL CONSTRAINT [comments_id_def] DEFAULT NEXT VALUE FOR [comments_id_seq],
149 159
 	[post_id] [int] NOT NULL,
150 160
 	[message] [nvarchar](255) NOT NULL,
151 161
 	[category_id] [int] NOT NULL,
152
-	PRIMARY KEY CLUSTERED([id] ASC)
162
+	CONSTRAINT [comments_pkey] PRIMARY KEY CLUSTERED([id] ASC)
153 163
 )
154 164
 GO
155 165
 
166
+DROP SEQUENCE IF EXISTS [post_tags_id_seq]
167
+GO
168
+CREATE SEQUENCE [post_tags_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
169
+GO
170
+
156 171
 CREATE TABLE [post_tags](
157
-	[id] [int] IDENTITY,
172
+	[id] [int] NOT NULL CONSTRAINT [post_tags_id_def] DEFAULT NEXT VALUE FOR [post_tags_id_seq],
158 173
 	[post_id] [int] NOT NULL,
159 174
 	[tag_id] [int] NOT NULL,
160
-	PRIMARY KEY CLUSTERED([id] ASC)
175
+	CONSTRAINT [post_tags_pkey] PRIMARY KEY CLUSTERED([id] ASC)
161 176
 )
162 177
 GO
163 178
 
179
+DROP SEQUENCE IF EXISTS [posts_id_seq]
180
+GO
181
+CREATE SEQUENCE [posts_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
182
+GO
183
+
164 184
 CREATE TABLE [posts](
165
-	[id] [int] IDENTITY,
185
+	[id] [int] NOT NULL CONSTRAINT [posts_id_def] DEFAULT NEXT VALUE FOR [posts_id_seq],
166 186
 	[user_id] [int] NOT NULL,
167 187
 	[category_id] [int] NOT NULL,
168 188
 	[content] [nvarchar](255) NOT NULL,
169
-	PRIMARY KEY CLUSTERED([id] ASC)
189
+	CONSTRAINT [posts_pkey] PRIMARY KEY CLUSTERED([id] ASC)
170 190
 )
171 191
 GO
172 192
 
193
+DROP SEQUENCE IF EXISTS [tags_id_seq]
194
+GO
195
+CREATE SEQUENCE [tags_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
196
+GO
197
+
173 198
 CREATE TABLE [tags](
174
-	[id] [int] IDENTITY,
199
+	[id] [int] NOT NULL CONSTRAINT [tags_id_def] DEFAULT NEXT VALUE FOR [tags_id_seq],
175 200
 	[name] [nvarchar](255) NOT NULL,
176 201
 	[is_important] [bit] NOT NULL,
177
-	PRIMARY KEY CLUSTERED([id] ASC)
202
+	CONSTRAINT [tags_pkey] PRIMARY KEY CLUSTERED([id] ASC)
178 203
 )
179 204
 GO
180 205
 
206
+DROP SEQUENCE IF EXISTS [users_id_seq]
207
+GO
208
+CREATE SEQUENCE [users_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
209
+GO
210
+
181 211
 CREATE TABLE [users](
182
-	[id] [int] IDENTITY,
212
+	[id] [int] NOT NULL CONSTRAINT [users_id_def] DEFAULT NEXT VALUE FOR [users_id_seq],
183 213
 	[username] [nvarchar](255) NOT NULL,
184 214
 	[password] [nvarchar](255) NOT NULL,
185 215
 	[location] [geometry],
186
-	CONSTRAINT [PK_users]
187
-	PRIMARY KEY CLUSTERED([id] ASC)
216
+	CONSTRAINT [users_pkey] PRIMARY KEY CLUSTERED([id] ASC)
188 217
 )
189 218
 GO
190 219
 
220
+DROP SEQUENCE IF EXISTS [countries_id_seq]
221
+GO
222
+CREATE SEQUENCE [countries_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
223
+GO
224
+
191 225
 CREATE TABLE [countries](
192
-	[id] [int] IDENTITY,
226
+	[id] [int] NOT NULL CONSTRAINT [countries_id_def] DEFAULT NEXT VALUE FOR [countries_id_seq],
193 227
 	[name] [nvarchar](255) NOT NULL,
194 228
 	[shape] [geometry] NOT NULL,
195
-	CONSTRAINT [PK_countries]
196
-	PRIMARY KEY CLUSTERED([id] ASC)
229
+	CONSTRAINT [countries_pkey] PRIMARY KEY CLUSTERED([id] ASC)
197 230
 )
198 231
 GO
199 232
 
233
+DROP SEQUENCE IF EXISTS [events_id_seq]
234
+GO
235
+CREATE SEQUENCE [events_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
236
+GO
237
+
200 238
 CREATE TABLE [events](
201
-	[id] [int] IDENTITY,
239
+	[id] [int] NOT NULL CONSTRAINT [events_id_def] DEFAULT NEXT VALUE FOR [events_id_seq],
202 240
 	[name] [nvarchar](255) NOT NULL,
203 241
 	[datetime] [datetime2](0),
204 242
 	[visitors] [bigint],
205
-	CONSTRAINT [PK_events]
206
-	PRIMARY KEY CLUSTERED([id] ASC)
243
+	CONSTRAINT [events_pkey] PRIMARY KEY CLUSTERED([id] ASC)
207 244
 )
208 245
 GO
209 246
 
@@ -212,25 +249,33 @@ AS
212 249
 SELECT top 100 PERCENT name, COUNT_BIG(name) AS [count] FROM tags, post_tags WHERE tags.id = post_tags.tag_id GROUP BY name ORDER BY [count] DESC, name
213 250
 GO
214 251
 
252
+DROP SEQUENCE IF EXISTS [products_id_seq]
253
+GO
254
+CREATE SEQUENCE [products_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
255
+GO
256
+
215 257
 CREATE TABLE [products](
216
-	[id] [int] IDENTITY,
258
+	[id] [int] NOT NULL CONSTRAINT [products_id_def] DEFAULT NEXT VALUE FOR [products_id_seq],
217 259
 	[name] [nvarchar](255) NOT NULL,
218 260
 	[price] [decimal](10,2) NOT NULL,
219 261
 	[properties] [xml] NOT NULL,
220 262
 	[created_at] [datetime2](0) NOT NULL,
221 263
 	[deleted_at] [datetime2](0),
222
-	CONSTRAINT [PK_products]
223
-	PRIMARY KEY CLUSTERED([id] ASC)
264
+	CONSTRAINT [products_pkey] PRIMARY KEY CLUSTERED([id] ASC)
224 265
 )
225 266
 GO
226 267
 
268
+DROP SEQUENCE IF EXISTS [barcodes_id_seq]
269
+GO
270
+CREATE SEQUENCE [barcodes_id_seq] AS int START WITH 1 INCREMENT BY 1 NO CACHE
271
+GO
272
+
227 273
 CREATE TABLE [barcodes](
228
-	[id] [int] IDENTITY,
274
+	[id] [int] NOT NULL CONSTRAINT [barcodes_id_def] DEFAULT NEXT VALUE FOR [barcodes_id_seq],
229 275
 	[product_id] [int] NOT NULL,
230 276
 	[hex] [nvarchar](255) NOT NULL,
231 277
 	[bin] [varbinary](max) NOT NULL,
232
-	CONSTRAINT [PK_barcodes]
233
-	PRIMARY KEY CLUSTERED([id] ASC)
278
+	CONSTRAINT [barcodes_pkey] PRIMARY KEY CLUSTERED([id] ASC)
234 279
 )
235 280
 GO
236 281
 
@@ -239,15 +284,13 @@ CREATE TABLE [kunsthåndværk](
239 284
 	[Umlauts ä_ö_ü-COUNT] [int] NOT NULL,
240 285
 	[user_id] [int] NOT NULL,
241 286
 	[invisible] [nvarchar](36),
242
-	CONSTRAINT [PK_kunsthåndværk]
243
-	PRIMARY KEY CLUSTERED([id] ASC)
287
+	CONSTRAINT [kunsthåndværk_pkey] PRIMARY KEY CLUSTERED([id] ASC)
244 288
 )
245 289
 GO
246 290
 
247 291
 CREATE TABLE [invisibles](
248 292
 	[id] [nvarchar](36) NOT NULL,
249
-	CONSTRAINT [PK_invisibles]
250
-	PRIMARY KEY CLUSTERED([id] ASC)
293
+	CONSTRAINT [invisibles_pkey] PRIMARY KEY CLUSTERED([id] ASC)
251 294
 )
252 295
 GO
253 296
 
@@ -321,53 +364,53 @@ GO
321 364
 INSERT [nopk] ([id]) VALUES ('e42c77c6-06a4-4502-816c-d112c7142e6d')
322 365
 GO
323 366
 
324
-ALTER TABLE [comments]  WITH CHECK ADD 	CONSTRAINT [FK_comments_posts] FOREIGN KEY([post_id])
367
+ALTER TABLE [comments]  WITH CHECK ADD 	CONSTRAINT [comments_post_id_fkey] FOREIGN KEY([post_id])
325 368
 REFERENCES [posts] ([id])
326 369
 GO
327
-ALTER TABLE [comments] CHECK	CONSTRAINT [FK_comments_posts]
370
+ALTER TABLE [comments] CHECK	CONSTRAINT [comments_post_id_fkey]
328 371
 GO
329 372
 
330
-ALTER TABLE [comments]  WITH CHECK ADD 	CONSTRAINT [FK_comments_categories] FOREIGN KEY([category_id])
373
+ALTER TABLE [comments]  WITH CHECK ADD 	CONSTRAINT [comments_category_id_fkey] FOREIGN KEY([category_id])
331 374
 REFERENCES [categories] ([id])
332 375
 GO
333
-ALTER TABLE [comments] CHECK	CONSTRAINT [FK_comments_categories]
376
+ALTER TABLE [comments] CHECK	CONSTRAINT [comments_category_id_fkey]
334 377
 GO
335 378
 
336
-ALTER TABLE [post_tags]  WITH CHECK ADD 	CONSTRAINT [FK_post_tags_posts] FOREIGN KEY([post_id])
379
+ALTER TABLE [post_tags]  WITH CHECK ADD 	CONSTRAINT [post_tags_post_id_fkey] FOREIGN KEY([post_id])
337 380
 REFERENCES [posts] ([id])
338 381
 GO
339
-ALTER TABLE [post_tags] CHECK	CONSTRAINT [FK_post_tags_posts]
382
+ALTER TABLE [post_tags] CHECK	CONSTRAINT [post_tags_post_id_fkey]
340 383
 GO
341 384
 
342
-ALTER TABLE [post_tags]  WITH CHECK ADD 	CONSTRAINT [FK_post_tags_tags] FOREIGN KEY([tag_id])
385
+ALTER TABLE [post_tags]  WITH CHECK ADD 	CONSTRAINT [post_tags_tag_id_fkey] FOREIGN KEY([tag_id])
343 386
 REFERENCES [tags] ([id])
344 387
 GO
345
-ALTER TABLE [post_tags] CHECK	CONSTRAINT [FK_post_tags_tags]
388
+ALTER TABLE [post_tags] CHECK	CONSTRAINT [post_tags_tag_id_fkey]
346 389
 GO
347 390
 
348
-ALTER TABLE [posts]  WITH CHECK ADD 	CONSTRAINT [FK_posts_categories] FOREIGN KEY([category_id])
391
+ALTER TABLE [posts]  WITH CHECK ADD 	CONSTRAINT [posts_category_id_fkey] FOREIGN KEY([category_id])
349 392
 REFERENCES [categories] ([id])
350 393
 GO
351
-ALTER TABLE [posts] CHECK	CONSTRAINT [FK_posts_categories]
394
+ALTER TABLE [posts] CHECK	CONSTRAINT [posts_category_id_fkey]
352 395
 GO
353 396
 
354
-ALTER TABLE [posts]  WITH CHECK ADD 	CONSTRAINT [FK_posts_users] FOREIGN KEY([user_id])
397
+ALTER TABLE [posts]  WITH CHECK ADD 	CONSTRAINT [posts_user_id_fkey] FOREIGN KEY([user_id])
355 398
 REFERENCES [users] ([id])
356 399
 GO
357
-ALTER TABLE [posts] CHECK	CONSTRAINT [FK_posts_users]
400
+ALTER TABLE [posts] CHECK	CONSTRAINT [posts_user_id_fkey]
358 401
 GO
359 402
 
360
-ALTER TABLE [barcodes]  WITH CHECK ADD 	CONSTRAINT [FK_barcodes_products] FOREIGN KEY([product_id])
403
+ALTER TABLE [barcodes]  WITH CHECK ADD 	CONSTRAINT [barcodes_product_id_fkey] FOREIGN KEY([product_id])
361 404
 REFERENCES [products] ([id])
362 405
 GO
363
-ALTER TABLE [barcodes] CHECK	CONSTRAINT [FK_barcodes_products]
406
+ALTER TABLE [barcodes] CHECK	CONSTRAINT [barcodes_product_id_fkey]
364 407
 GO
365 408
 
366 409
 ALTER TABLE [kunsthåndværk]  WITH CHECK ADD 	CONSTRAINT [UC_kunsthåndværk_Umlauts ä_ö_ü-COUNT] UNIQUE([Umlauts ä_ö_ü-COUNT])
367 410
 GO
368 411
 
369
-ALTER TABLE [kunsthåndværk]  WITH CHECK ADD 	CONSTRAINT [FK_kunsthåndværk_users] FOREIGN KEY([user_id])
412
+ALTER TABLE [kunsthåndværk]  WITH CHECK ADD 	CONSTRAINT [kunsthåndværk_user_id_fkey] FOREIGN KEY([user_id])
370 413
 REFERENCES [users] ([id])
371 414
 GO
372
-ALTER TABLE [kunsthåndværk] CHECK	CONSTRAINT [FK_kunsthåndværk_users]
415
+ALTER TABLE [kunsthåndværk] CHECK	CONSTRAINT [kunsthåndværk_user_id_fkey]
373 416
 GO

+ 0
- 35
tests/functional/003_columns/004_update_barcodes_id_column.log.skip Wyświetl plik

@@ -1,35 +0,0 @@
1
-PUT /columns/barcodes/id
2
-
3
-{"name":"id2","type":"bigint"}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes/id2
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 40
16
-
17
-{"name":"id2","type":"bigint","pk":true}
18
-===
19
-PUT /columns/barcodes/id2
20
-
21
-{"name":"id","type":"integer"}
22
-===
23
-200
24
-Content-Type: application/json
25
-Content-Length: 4
26
-
27
-true
28
-===
29
-GET /columns/barcodes/id
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 40
34
-
35
-{"name":"id","type":"integer","pk":true}

+ 0
- 35
tests/functional/003_columns/005_update_barcodes_product_id_nullable.log.skip Wyświetl plik

@@ -1,35 +0,0 @@
1
-PUT /columns/barcodes/product_id
2
-
3
-{"nullable":true}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes/product_id
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 70
16
-
17
-{"name":"product_id","type":"integer","nullable":true,"fk":"products"}
18
-===
19
-PUT /columns/barcodes/product_id
20
-
21
-{"nullable":false}
22
-===
23
-200
24
-Content-Type: application/json
25
-Content-Length: 4
26
-
27
-true
28
-===
29
-GET /columns/barcodes/product_id
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 54
34
-
35
-{"name":"product_id","type":"integer","fk":"products"}

+ 0
- 61
tests/functional/003_columns/006_update_events_visitors_pk.log.skip Wyświetl plik

@@ -1,61 +0,0 @@
1
-PUT /columns/events/visitors
2
-
3
-{"pk":true}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/events/visitors
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 46
16
-
17
-{"name":"visitors","type":"integer","pk":true}
18
-===
19
-GET /columns/events/id
20
-===
21
-200
22
-Content-Type: application/json
23
-Content-Length: 30
24
-
25
-{"name":"id","type":"integer"}
26
-===
27
-PUT /columns/events/visitors
28
-
29
-{"pk":false}
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 4
34
-
35
-true
36
-===
37
-GET /columns/events/visitors
38
-===
39
-200
40
-Content-Type: application/json
41
-Content-Length: 36
42
-
43
-{"name":"visitors","type":"integer"}
44
-===
45
-PUT /columns/events/id
46
-
47
-{"pk":true}
48
-===
49
-200
50
-Content-Type: application/json
51
-Content-Length: 4
52
-
53
-true
54
-===
55
-GET /columns/events/id
56
-===
57
-200
58
-Content-Type: application/json
59
-Content-Length: 40
60
-
61
-{"name":"id","type":"integer","pk":true}

+ 0
- 35
tests/functional/003_columns/007_update_barcodes_product_id_fk.log.skip Wyświetl plik

@@ -1,35 +0,0 @@
1
-PUT /columns/barcodes/product_id
2
-
3
-{"fk":""}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes/product_id
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 38
16
-
17
-{"name":"product_id","type":"integer"}
18
-===
19
-PUT /columns/barcodes/product_id
20
-
21
-{"fk":"products"}
22
-===
23
-200
24
-Content-Type: application/json
25
-Content-Length: 4
26
-
27
-true
28
-===
29
-GET /columns/barcodes/product_id
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 54
34
-
35
-{"name":"product_id","type":"integer","fk":"products"}

+ 0
- 35
tests/functional/003_columns/008_update_barcodes_table.log.skip Wyświetl plik

@@ -1,35 +0,0 @@
1
-PUT /columns/barcodes
2
-
3
-{"name":"barcodes2"}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes2
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 217
16
-
17
-{"name":"barcodes2","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"}]}
18
-===
19
-PUT /columns/barcodes2
20
-
21
-{"name":"barcodes"}
22
-===
23
-200
24
-Content-Type: application/json
25
-Content-Length: 4
26
-
27
-true
28
-===
29
-GET /columns/barcodes
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 216
34
-
35
-{"name":"barcodes","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"}]}

+ 0
- 35
tests/functional/003_columns/009_update_barcodes_hex_type.log.skip Wyświetl plik

@@ -1,35 +0,0 @@
1
-PUT /columns/barcodes/hex
2
-
3
-{"type":"clob"}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes/hex
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 28
16
-
17
-{"name":"hex","type":"clob"}
18
-===
19
-PUT /columns/barcodes/hex
20
-
21
-{"type":"varchar","length":255}
22
-===
23
-200
24
-Content-Type: application/json
25
-Content-Length: 4
26
-
27
-true
28
-===
29
-GET /columns/barcodes/hex
30
-===
31
-200
32
-Content-Type: application/json
33
-Content-Length: 44
34
-
35
-{"name":"hex","type":"varchar","length":255}

+ 0
- 25
tests/functional/003_columns/010_create_barcodes_table.log.skip Wyświetl plik

@@ -1,25 +0,0 @@
1
-POST /columns
2
-
3
-{"name":"barcodes2","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"}]}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes2
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 217
16
-
17
-{"name":"barcodes2","type":"table","columns":[{"name":"id","type":"integer","pk":true},{"name":"product_id","type":"integer","fk":"products"},{"name":"hex","type":"varchar","length":255},{"name":"bin","type":"blob"}]}
18
-===
19
-DELETE /columns/barcodes2
20
-===
21
-200
22
-Content-Type: application/json
23
-Content-Length: 4
24
-
25
-true

+ 0
- 25
tests/functional/003_columns/011_create_barcodes_column.log.skip Wyświetl plik

@@ -1,25 +0,0 @@
1
-POST /columns/barcodes
2
-
3
-{"name":"alternative_product_id","type":"integer","nullable":true,"fk":"products"}
4
-===
5
-200
6
-Content-Type: application/json
7
-Content-Length: 4
8
-
9
-true
10
-===
11
-GET /columns/barcodes/alternative_product_id
12
-===
13
-200
14
-Content-Type: application/json
15
-Content-Length: 82
16
-
17
-{"name":"alternative_product_id","type":"integer","nullable":true,"fk":"products"}
18
-===
19
-DELETE /columns/barcodes/alternative_product_id
20
-===
21
-200
22
-Content-Type: application/json
23
-Content-Length: 4
24
-
25
-true

Loading…
Anuluj
Zapisz