drift
drift copied to clipboard
Steps Migrations - error types Postges DateTime
When run - dart run drift_dev make-migrations was created file .steps.dart but linter check error, please help how fix this error?
i1.GeneratedColumn<int> _column_0(String aliasedName) =>
i1.GeneratedColumn<int>('id', aliasedName, false,
hasAutoIncrement: true, type: i1.DriftSqlType.int);
i1.GeneratedColumn<double> _column_1(String aliasedName) =>
i1.GeneratedColumn<double>('created_at', aliasedName, true,
type: i1.DriftSqlType.double, defaultValue: now());
My fields
Could you post the linter errror or the complete tables so that I can reproduce this? Thanks!
For example 2 models with mixin TableMixin The function 'now' isn't defined. (undefined_function at /database.steps.dart:208) if add import 'package:drift_postgres/drift_postgres.dart';
class LinkDocuments extends Table with TableMixin {
IntColumn get userId => integer().references(Users, #id)();
}
class Users extends Table with TableMixin {
TextColumn get name => text()();
}
mixin TableMixin on Table {
late final IntColumn id = integer().autoIncrement()();
late final TimestampColumn createdAt =
customType(PgTypes.timestampWithTimezone).nullable().withDefault(now())();
late final TimestampColumn updatedAt =
customType(PgTypes.timestampWithTimezone).nullable().withDefault(now())();
late final TimestampColumn deletedAt =
customType(PgTypes.timestampWithTimezone).nullable().withDefault(now())();
}
The tests have errors too