@@ -3,41 +3,41 @@ import XCTest
33
44class SchemaChangerTests : SQLiteTestCase {
55 var schemaChanger : SchemaChanger !
6- var schemaReader : SchemaReader !
6+ var schema : SchemaReader !
77
88 override func setUpWithError( ) throws {
99 try super. setUpWithError ( )
1010 try createUsersTable ( )
1111
1212 try insertUsers ( " bob " )
1313
14- schemaReader = SchemaReader ( connection: db)
14+ schema = SchemaReader ( connection: db)
1515 schemaChanger = SchemaChanger ( connection: db)
1616 }
1717
1818 func test_empty_migration_does_not_change_column_definitions( ) throws {
19- let previous = try schemaReader . columnDefinitions ( table: " users " )
19+ let previous = try schema . columnDefinitions ( table: " users " )
2020 try schemaChanger. alter ( table: " users " ) { _ in
2121 }
22- let current = try schemaReader . columnDefinitions ( table: " users " )
22+ let current = try schema . columnDefinitions ( table: " users " )
2323
2424 XCTAssertEqual ( previous, current)
2525 }
2626
2727 func test_empty_migration_does_not_change_index_definitions( ) throws {
28- let previous = try schemaReader . indexDefinitions ( table: " users " )
28+ let previous = try schema . indexDefinitions ( table: " users " )
2929 try schemaChanger. alter ( table: " users " ) { _ in
3030 }
31- let current = try schemaReader . indexDefinitions ( table: " users " )
31+ let current = try schema . indexDefinitions ( table: " users " )
3232
3333 XCTAssertEqual ( previous, current)
3434 }
3535
3636 func test_empty_migration_does_not_change_foreign_key_definitions( ) throws {
37- let previous = try schemaReader . foreignKeys ( table: " users " )
37+ let previous = try schema . foreignKeys ( table: " users " )
3838 try schemaChanger. alter ( table: " users " ) { _ in
3939 }
40- let current = try schemaReader . foreignKeys ( table: " users " )
40+ let current = try schema . foreignKeys ( table: " users " )
4141
4242 XCTAssertEqual ( previous, current)
4343 }
@@ -51,21 +51,21 @@ class SchemaChangerTests: SQLiteTestCase {
5151 XCTAssertEqual ( previous, current)
5252 }
5353
54- func test_remove_column ( ) throws {
54+ func test_drop_column ( ) throws {
5555 try schemaChanger. alter ( table: " users " ) { table in
56- table. remove ( " age " )
56+ table. drop ( " age " )
5757 }
58- let columns = try schemaReader . columnDefinitions ( table: " users " ) . map ( \. name)
58+ let columns = try schema . columnDefinitions ( table: " users " ) . map ( \. name)
5959 XCTAssertFalse ( columns. contains ( " age " ) )
6060 }
6161
62- func test_remove_column_legacy ( ) throws {
62+ func test_drop_column_legacy ( ) throws {
6363 schemaChanger = . init( connection: db, version: . init( major: 3 , minor: 24 ) ) // DROP COLUMN introduced in 3.35.0
6464
6565 try schemaChanger. alter ( table: " users " ) { table in
66- table. remove ( " age " )
66+ table. drop ( " age " )
6767 }
68- let columns = try schemaReader . columnDefinitions ( table: " users " ) . map ( \. name)
68+ let columns = try schema . columnDefinitions ( table: " users " ) . map ( \. name)
6969 XCTAssertFalse ( columns. contains ( " age " ) )
7070 }
7171
@@ -74,7 +74,7 @@ class SchemaChangerTests: SQLiteTestCase {
7474 table. rename ( " age " , to: " age2 " )
7575 }
7676
77- let columns = try schemaReader . columnDefinitions ( table: " users " ) . map ( \. name)
77+ let columns = try schema . columnDefinitions ( table: " users " ) . map ( \. name)
7878 XCTAssertFalse ( columns. contains ( " age " ) )
7979 XCTAssertTrue ( columns. contains ( " age2 " ) )
8080 }
@@ -86,7 +86,7 @@ class SchemaChangerTests: SQLiteTestCase {
8686 table. rename ( " age " , to: " age2 " )
8787 }
8888
89- let columns = try schemaReader . columnDefinitions ( table: " users " ) . map ( \. name)
89+ let columns = try schema . columnDefinitions ( table: " users " ) . map ( \. name)
9090 XCTAssertFalse ( columns. contains ( " age " ) )
9191 XCTAssertTrue ( columns. contains ( " age2 " ) )
9292 }
@@ -102,7 +102,7 @@ class SchemaChangerTests: SQLiteTestCase {
102102 table. add ( newColumn)
103103 }
104104
105- let columns = try schemaReader . columnDefinitions ( table: " users " )
105+ let columns = try schema . columnDefinitions ( table: " users " )
106106 XCTAssertTrue ( columns. contains ( newColumn) )
107107
108108 XCTAssertEqual ( try db. pluck ( users. select ( column) ) ? [ column] , " foo " )
0 commit comments