@@ -317,6 +317,10 @@ class SchemaTests: XCTestCase {
317317 " CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE REFERENCES \" table \" ( \" int64 \" )) " ,
318318 table. create { t in t. column ( int64, unique: true , references: table, int64) }
319319 )
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+ )
320324 XCTAssertEqual (
321325 " CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
322326 table. create { t in t. column ( int64, check: int64 > 0 , references: table, int64) }
@@ -329,13 +333,24 @@ class SchemaTests: XCTestCase {
329333 " CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
330334 table. create { t in t. column ( int64, unique: true , check: int64 > 0 , references: table, int64) }
331335 )
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+ )
332340 XCTAssertEqual (
333341 """
334342 CREATE TABLE \" table \" ( \" int64 \" INTEGER NOT NULL UNIQUE CHECK ( \" int64Optional \" > 0) REFERENCES
335343 \" table \" ( \" int64 \" ))
336344 """ . replacingOccurrences ( of: " \n " , with: " " ) ,
337345 table. create { t in t. column ( int64, unique: true , check: int64Optional > 0 , references: table, int64) }
338346 )
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+ )
339354
340355 XCTAssertEqual (
341356 " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER REFERENCES \" table \" ( \" int64 \" )) " ,
@@ -345,6 +360,10 @@ class SchemaTests: XCTestCase {
345360 " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE REFERENCES \" table \" ( \" int64 \" )) " ,
346361 table. create { t in t. column ( int64Optional, unique: true , references: table, int64) }
347362 )
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+ )
348367 XCTAssertEqual (
349368 " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
350369 table. create { t in t. column ( int64Optional, check: int64 > 0 , references: table, int64) }
@@ -357,10 +376,18 @@ class SchemaTests: XCTestCase {
357376 " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE CHECK ( \" int64 \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
358377 table. create { t in t. column ( int64Optional, unique: true , check: int64 > 0 , references: table, int64) }
359378 )
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+ )
360383 XCTAssertEqual (
361384 " CREATE TABLE \" table \" ( \" int64Optional \" INTEGER UNIQUE CHECK ( \" int64Optional \" > 0) REFERENCES \" table \" ( \" int64 \" )) " ,
362385 table. create { t in t. column ( int64Optional, unique: true , check: int64Optional > 0 , references: table, int64) }
363386 )
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+ )
364391 }
365392
366393 func test_column_withStringExpression_compilesCollatedColumnDefinitionExpression( ) {
0 commit comments