Skip to content

Commit fd7fba3

Browse files
committed
Fix DROP VIRTUAL TABLE regression
An integrated test suite (which we had, before) would have caught this. Fixes stephencelis#261. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent 85881c9 commit fd7fba3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Source/Typed/Schema.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension SchemaType {
2727
// MARK: - DROP TABLE / VIEW / VIRTUAL TABLE
2828

2929
public func drop(ifExists ifExists: Bool = false) -> String {
30-
return drop(Self.identifier, tableName(), ifExists)
30+
return drop("TABLE", tableName(), ifExists)
3131
}
3232

3333
}
@@ -183,6 +183,12 @@ extension View {
183183
return " ".join(clauses.flatMap { $0 }).asSQL()
184184
}
185185

186+
// MARK: - DROP VIEW
187+
188+
public func drop(ifExists ifExists: Bool = false) -> String {
189+
return drop("VIEW", tableName(), ifExists)
190+
}
191+
186192
}
187193

188194
extension VirtualTable {

Tests/SchemaTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class SchemaTests : XCTestCase {
99
}
1010

1111
func test_drop_compilesDropVirtualTableExpression() {
12-
XCTAssertEqual("DROP VIRTUAL TABLE \"virtual_table\"", virtualTable.drop())
13-
XCTAssertEqual("DROP VIRTUAL TABLE IF EXISTS \"virtual_table\"", virtualTable.drop(ifExists: true))
12+
XCTAssertEqual("DROP TABLE \"virtual_table\"", virtualTable.drop())
13+
XCTAssertEqual("DROP TABLE IF EXISTS \"virtual_table\"", virtualTable.drop(ifExists: true))
1414
}
1515

1616
func test_drop_compilesDropViewExpression() {

0 commit comments

Comments
 (0)