diff --git a/moor/test/data/tables/todos.dart b/moor/test/data/tables/todos.dart index 1d85e4db..e2855990 100644 --- a/moor/test/data/tables/todos.dart +++ b/moor/test/data/tables/todos.dart @@ -18,7 +18,7 @@ class TodosTable extends Table { class Users extends Table { IntColumn get id => integer().autoIncrement()(); TextColumn get name => text().withLength(min: 6, max: 32)(); - BoolColumn get isAwesome => boolean()(); + BoolColumn get isAwesome => boolean().withDefault(const Constant(true))(); BlobColumn get profilePicture => blob()(); DateTimeColumn get creationTime => diff --git a/moor/test/data/tables/todos.g.dart b/moor/test/data/tables/todos.g.dart index 42856cb8..52ec1f5d 100644 --- a/moor/test/data/tables/todos.g.dart +++ b/moor/test/data/tables/todos.g.dart @@ -443,11 +443,8 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> { GeneratedBoolColumn _constructIsAwesome() { var cName = 'is_awesome'; if (_alias != null) cName = '$_alias.$cName'; - return GeneratedBoolColumn( - 'is_awesome', - $tableName, - false, - ); + return GeneratedBoolColumn('is_awesome', $tableName, false, + defaultValue: const Constant(true)); } GeneratedBlobColumn _profilePicture; diff --git a/moor/test/schema_test.dart b/moor/test/schema_test.dart index 828da05a..ba367535 100644 --- a/moor/test/schema_test.dart +++ b/moor/test/schema_test.dart @@ -28,7 +28,7 @@ void main() { verify(mockQueryExecutor.call('CREATE TABLE IF NOT EXISTS users ' '(id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR NOT NULL, ' - 'is_awesome BOOLEAN NOT NULL CHECK (is_awesome in (0, 1)), ' + 'is_awesome BOOLEAN NOT NULL DEFAULT 1 CHECK (is_awesome in (0, 1)), ' 'profile_picture BLOB NOT NULL, ' 'creation_time INTEGER NOT NULL ' "DEFAULT (strftime('%s', CURRENT_TIMESTAMP)));")); @@ -50,7 +50,7 @@ void main() { verify(mockQueryExecutor.call('CREATE TABLE IF NOT EXISTS users ' '(id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR NOT NULL, ' - 'is_awesome BOOLEAN NOT NULL CHECK (is_awesome in (0, 1)), ' + 'is_awesome BOOLEAN NOT NULL DEFAULT 1 CHECK (is_awesome in (0, 1)), ' 'profile_picture BLOB NOT NULL, ' 'creation_time INTEGER NOT NULL ' "DEFAULT (strftime('%s', CURRENT_TIMESTAMP)));")); @@ -67,7 +67,7 @@ void main() { .addColumn(db.users, db.users.isAwesome); verify(mockQueryExecutor.call('ALTER TABLE users ADD COLUMN ' - 'is_awesome BOOLEAN NOT NULL CHECK (is_awesome in (0, 1));')); + 'is_awesome BOOLEAN NOT NULL DEFAULT 1 CHECK (is_awesome in (0, 1));')); }); }); }