Skip to content

Commit b13e077

Browse files
committed
Update SQLiteAdapter.swift
1 parent cb41853 commit b13e077

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Sources/SQLiteAdapter/SQLiteAdapter.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public protocol SQLiteType {
5050
func checkIfTableExists(_ tableName: String) throws -> Bool
5151
func dropTable(_ tableName: String, vacuum: Bool) throws
5252
func deleteAllRows(in tableName: String, vacuum: Bool, resetAutoincrement: Bool) throws
53-
func dropIndex(in tableName: String, forColumn columnName: String) throws
5453
func addIndex(to tableName: String, forColumn columnName: String, unique: Bool, order: SQLOrder) throws
54+
func dropIndex(in tableName: String, forColumn columnName: String) throws
5555
func beginTransaction() throws
5656
func endTransaction() throws
5757
func insertRow(sql: String, valuesToBind: SQLValues?) throws
@@ -244,13 +244,6 @@ open class SQLite: SQLiteType {
244244
}
245245
}
246246

247-
public func dropIndex(in tableName: String, forColumn columnName: String) throws {
248-
let indexName = "\(tableName)_\(columnName)_idx"
249-
let sql = "DROP INDEX IF EXISTS \"\(indexName)\";"
250-
try operation(sql: sql)
251-
log("successfully droped index in \(tableName) for column \(columnName)")
252-
}
253-
254247
public func addIndex(to tableName: String, forColumn columnName: String, unique: Bool = false, order: SQLOrder = .none) throws {
255248

256249
let indexName = "\(tableName)_\(columnName)_idx"
@@ -275,6 +268,13 @@ open class SQLite: SQLiteType {
275268
log("successfully added index to \(tableName) for column \(columnName)")
276269
}
277270

271+
public func dropIndex(in tableName: String, forColumn columnName: String) throws {
272+
let indexName = "\(tableName)_\(columnName)_idx"
273+
let sql = "DROP INDEX IF EXISTS \"\(indexName)\";"
274+
try operation(sql: sql)
275+
log("successfully droped index in \(tableName) for column \(columnName)")
276+
}
277+
278278
public func beginTransaction() throws {
279279
let sql = "BEGIN TRANSACTION;"
280280
try operation(sql: sql)

0 commit comments

Comments
 (0)