                 ("ALTER TABLE \(TableHistory) ADD COLUMN domain_id INTEGER REFERENCES \(TableDomains)(id) ON DELETE CASCADE", nil)
             ]
 
-            if !self.run(db, queries: queries.filter({ $0.0 != nil }).map({ ($0.0!, $0.1) })) {
+            if !self.runValidQueries(db, queries: queries) {
                 return false
             }
 

        for (sql, args) in queries {
            if !run(db, sql: sql, args: args) {
                return false
            }
        }
        return true

    }

    func getDomainsTableCreationString(forVersion version: Int = BrowserTable.DefaultVersion) -> String? {
        if version <= 5 {
            return nil
        }

        return "CREATE TABLE IF NOT EXISTS \(TableDomains) (" +
                   "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                   "domain TEXT NOT NULL UNIQUE, " +
                   "showOnTopSites TINYINT NOT NULL DEFAULT 1" +
               ")"
    }

    func getQueueTableCreationString(forVersion version: Int = BrowserTable.DefaultVersion) -> String? {
        if version <= 4 {
            return nil
        }

        return "CREATE TABLE IF NOT EXISTS \(TableQueuedTabs) (" +
                   "url TEXT NOT NULL UNIQUE, " +
                   "title TEXT" +
               ") "
    }


