     }
     
     override var databasePrimaryKey : [String: DatabaseValue?] {
-        return ["ID": ID]
+        return ["UUID": UUID]
     }
     
     override func updateFromDatabaseRow(row: Row) {
-        if row.hasColumn("ID") { ID = row.value(named: "ID") }
+        if row.hasColumn("UUID") { UUID = row.value(named: "UUID") }
         if row.hasColumn("name") { name = row.value(named: "name") }
         if row.hasColumn("masterID") { masterID = row.value(named: "masterID") }
     }

        }
    }
    
    func testSelect() {
        assertNoError {
            try dbQueue.inTransaction { db in

    }
}

class Stuff: RowModel {
    var name: String?
    
    override var tableName: String? {
        return "stuffs"
    }
    
    override var databaseDictionary : [String: DatabaseValue?] {
        return ["name": name]
    }
    
    override func updateFromDatabaseRow(row: Row) {
        if row.hasColumn("name") { name = row.value(named: "name") }
    }
}

class Citizenship: RowModel {
    var personID: Int64?
    var countryName: String?
    
    override var tableName: String? {
        return "citizenships"
    }
    
    override var databaseDictionary : [String: DatabaseValue?] {
        return ["countryName": countryName, "personID": personID]
    }
    
    override func updateFromDatabaseRow(row: Row) {
        if row.hasColumn("personID") { personID = row.value(named: "personID") }
        if row.hasColumn("countryName") { countryName = row.value(named: "countryName") }
    }
}

class RowModelTests: GRDBTests {
    override func setUp() {
        super.setUp()
        
        var migrator = DatabaseMigrator()
        migrator.registerMigration("createPersons") { db in
            try db.execute(
                "CREATE TABLE persons (" +
                    "ID INTEGER PRIMARY KEY, " +
                    "name TEXT NOT NULL, " +
                    "age INT" +
                ")")
        }
        migrator.registerMigration("createPets") { db in
            try db.execute(
                "CREATE TABLE pets (" +
                    "UUID TEXT NOT NULL PRIMARY KEY, " +
                    "masterID INTEGER NOT NULL " +
                    "         REFERENCES persons(ID) " +
                    "         ON DELETE CASCADE ON UPDATE CASCADE, " +
                    "name TEXT" +
                ")")
        }
        migrator.registerMigration("createStuffs") { db in
            try db.execute(
                "CREATE TABLE stuffs (" +
                    "name NOT NULL" +
                ")")
        }
        migrator.registerMigration("createCitizenships") { db in
            try db.execute(
                "CREATE TABLE citizenships (" +
                    "personID INTEGER NOT NULL " +
                    "         REFERENCES persons(ID) " +
                    "         ON DELETE CASCADE ON UPDATE CASCADE, " +
                    "countryName TEXT NOT NULL, " +
                    "PRIMARY KEY (personID, countryName)" +
                ")")
        }
        assertNoError {
            try migrator.migrate(dbQueue)
        }
    }
    
    func testInsertRowModelWithManagedID() {
        assertNoError {
            let arthur = Person(name: "Arthur", age: 41)
            
            XCTAssertTrue(arthur.ID == nil)
            try dbQueue.inTransaction { db in
                // The tested method
                try arthur.insert(db)

                // After insertion, ID should be set
                XCTAssertTrue(arthur.ID != nil)
                
                return .Commit
            }
            
            // After insertion, person should be present in the database
            dbQueue.inDatabase { db in
                let persons = db.fetchAllModels("SELECT * FROM persons ORDER BY name", type: Person.self)
                XCTAssertEqual(persons.count, 1)
                XCTAssertEqual(persons.first!.name!, "Arthur")
            }
        }
    }
    
    func testInsertTwiceRowModelWithManagedID() {
        assertNoError {
            let arthur = Person(name: "Arthur", age: 41)
            
