@@ -317,6 +317,10 @@ class SchemaTests: XCTestCase {
317
317
" CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE REFERENCES \" table \" ( \" int64 \" )) " ,
318
318
table. create { t in t. column ( int64, unique: true , references: table, int64) }
319
319
)
320
+ XCTAssertEqual (
321
+ " CREATE TABLE \" table \" ( \" int64 \" INTEGER PRIMARY KEY NOT NULL REFERENCES \" table \" ( \" int64 \" )) " ,
322
+ table. create { t in t. column ( int64, primaryKey: true , references: table, int64) }
323
+ )
320
324
XCTAssertEqual (
321
325
" CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
322
326
table. create { t in t. column ( int64, check: int64 > 0 , references: table, int64) }
@@ -329,13 +333,24 @@ class SchemaTests: XCTestCase {
329
333
" CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
330
334
table. create { t in t. column ( int64, unique: true , check: int64 > 0 , references: table, int64) }
331
335
)
336
+ XCTAssertEqual (
337
+ " CREATE TABLE \" table \" ( \" int64 \" INTEGER PRIMARY KEY NOT NULL CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
338
+ table. create { t in t. column ( int64, primaryKey: true , check: int64 > 0 , references: table, int64) }
339
+ )
332
340
XCTAssertEqual (
333
341
"""
334
342
CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE CHECK ( \" int64Optional \" > 0) REFERENCES
335
343
\" table \" ( \" int64 \" ))
336
344
""" . replacingOccurrences ( of: " \n " , with: " " ) ,
337
345
table. create { t in t. column ( int64, unique: true , check: int64Optional > 0 , references: table, int64) }
338
346
)
347
+ XCTAssertEqual (
348
+ """
349
+ CREATE TABLE \" table \" ( \" int64 \" INTEGER PRIMARY KEY NOT NULL CHECK ( \" int64Optional \" > 0) REFERENCES
350
+ \" table \" ( \" int64 \" ))
351
+ """ . replacingOccurrences ( of: " \n " , with: " " ) ,
352
+ table. create { t in t. column ( int64, primaryKey: true , check: int64Optional > 0 , references: table, int64) }
353
+ )
339
354
340
355
XCTAssertEqual (
341
356
" CREATE TABLE \" table \" ( \" int64Optional \" INTEGER REFERENCES \" table \" ( \" int64 \" )) " ,
@@ -345,6 +360,10 @@ class SchemaTests: XCTestCase {
345
360
" CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE REFERENCES \" table \" ( \" int64 \" )) " ,
346
361
table. create { t in t. column ( int64Optional, unique: true , references: table, int64) }
347
362
)
363
+ XCTAssertEqual (
364
+ " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER PRIMARY KEY REFERENCES \" table \" ( \" int64 \" )) " ,
365
+ table. create { t in t. column ( int64Optional, primaryKey: true , references: table, int64) }
366
+ )
348
367
XCTAssertEqual (
349
368
" CREATE TABLE \" table \" ( \" int64Optional \" INTEGER CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
350
369
table. create { t in t. column ( int64Optional, check: int64 > 0 , references: table, int64) }
@@ -357,10 +376,18 @@ class SchemaTests: XCTestCase {
357
376
" CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
358
377
table. create { t in t. column ( int64Optional, unique: true , check: int64 > 0 , references: table, int64) }
359
378
)
379
+ XCTAssertEqual (
380
+ " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER PRIMARY KEY CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
381
+ table. create { t in t. column ( int64Optional, primaryKey: true , check: int64 > 0 , references: table, int64) }
382
+ )
360
383
XCTAssertEqual (
361
384
" CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE CHECK ( \" int64Optional \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
362
385
table. create { t in t. column ( int64Optional, unique: true , check: int64Optional > 0 , references: table, int64) }
363
386
)
387
+ XCTAssertEqual (
388
+ " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER PRIMARY KEY CHECK ( \" int64Optional \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
389
+ table. create { t in t. column ( int64Optional, primaryKey: true , check: int64Optional > 0 , references: table, int64) }
390
+ )
364
391
}
365
392
366
393
func test_column_withStringExpression_compilesCollatedColumnDefinitionExpression( ) {
0 commit comments