     }
 }
 
+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)")
+                    "age INT" +
+                ")")
         }
         migrator.registerMigration("createPets") { db in
             try db.execute(
                 "CREATE TABLE pets (" +
-                    "ID INTEGER PRIMARY KEY, " +
+                    "UUID TEXT NOT NULL PRIMARY KEY, " +
                     "masterID INTEGER NOT NULL " +
                     "         REFERENCES persons(ID) " +
                     "         ON DELETE CASCADE ON UPDATE CASCADE, " +
-                "name TEXT)")
-        }
-        try! migrator.migrate(dbQueue)
-    }
-    
-    func testInsert() {
+                    "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
-                try arthur.insert(db)
-                return .Commit
-            }
-            XCTAssertTrue(arthur.ID != nil)
-        }
-    }
-    
-    func testInsertTwiceBreaksUniqueIndex() {
+                // 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)
             

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

}

class Pet: RowModel {
    var UUID: String?
    var masterID: Int64?
    var name: String?
    
