mirror of https://github.com/AMT-Cheif/drift.git
Fix unique constraint tests
This commit is contained in:
parent
171cf88aac
commit
ec53328e49
|
@ -62,7 +62,7 @@ void main() {
|
|||
);
|
||||
await db.into(db.users).insert(
|
||||
UsersCompanion.insert(
|
||||
name: 'User name',
|
||||
name: 'User name 2',
|
||||
profilePicture: Uint8List(0),
|
||||
creationTime: Value(secondTime)),
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ void main() {
|
|||
b.insertAll(db.users, [
|
||||
for (var i = 0; i < 1000; i++)
|
||||
UsersCompanion.insert(
|
||||
name: 'user name', profilePicture: Uint8List(0)),
|
||||
name: 'user name $i', profilePicture: Uint8List(0)),
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ void main() {
|
|||
verify(mockExecutor.runCustom(
|
||||
'CREATE TABLE IF NOT EXISTS todos '
|
||||
'(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title TEXT NULL, '
|
||||
'content TEXT NOT NULL, target_date INTEGER NULL, '
|
||||
'category INTEGER NULL REFERENCES categories (id));',
|
||||
'content TEXT NOT NULL, target_date INTEGER NULL UNIQUE, '
|
||||
'category INTEGER NULL REFERENCES categories (id), '
|
||||
'UNIQUE (title, category), UNIQUE (title, target_date));',
|
||||
[]));
|
||||
|
||||
verify(mockExecutor.runCustom(
|
||||
|
@ -39,7 +40,7 @@ void main() {
|
|||
verify(mockExecutor.runCustom(
|
||||
'CREATE TABLE IF NOT EXISTS users '
|
||||
'(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, '
|
||||
'name TEXT NOT NULL, '
|
||||
'name TEXT NOT NULL UNIQUE, '
|
||||
'is_awesome INTEGER NOT NULL DEFAULT 1 CHECK (is_awesome IN (0, 1)), '
|
||||
'profile_picture BLOB NOT NULL, '
|
||||
'creation_time INTEGER NOT NULL '
|
||||
|
@ -91,7 +92,7 @@ void main() {
|
|||
verify(mockExecutor.runCustom(
|
||||
'CREATE TABLE IF NOT EXISTS users '
|
||||
'(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, '
|
||||
'name TEXT NOT NULL, '
|
||||
'name TEXT NOT NULL UNIQUE, '
|
||||
'is_awesome INTEGER NOT NULL DEFAULT 1 CHECK (is_awesome IN (0, 1)), '
|
||||
'profile_picture BLOB NOT NULL, '
|
||||
'creation_time INTEGER NOT NULL '
|
||||
|
|
Loading…
Reference in New Issue