mirror of https://github.com/AMT-Cheif/drift.git
Re-generate migration tests
This commit is contained in:
parent
360ee348a2
commit
ea6a8a2217
|
@ -54,7 +54,7 @@ class DumpSchemaCommand extends Command {
|
||||||
|
|
||||||
final result = input.fileAnalysis!;
|
final result = input.fileAnalysis!;
|
||||||
final databaseElement = databases.single;
|
final databaseElement = databases.single;
|
||||||
final db = result.resolvedDatabases[databaseElement]!;
|
final db = result.resolvedDatabases[databaseElement.id]!;
|
||||||
|
|
||||||
final writer =
|
final writer =
|
||||||
SchemaWriter(db.availableElements, options: cli.project.moorOptions);
|
SchemaWriter(db.availableElements, options: cli.project.moorOptions);
|
||||||
|
|
|
@ -147,8 +147,8 @@ class SchemaWriter {
|
||||||
'customConstraints': column.customConstraints,
|
'customConstraints': column.customConstraints,
|
||||||
if (constraints.isNotEmpty && column.customConstraints == null)
|
if (constraints.isNotEmpty && column.customConstraints == null)
|
||||||
'defaultConstraints': defaultConstraints(column),
|
'defaultConstraints': defaultConstraints(column),
|
||||||
'default_dart': column.defaultArgument,
|
'default_dart': column.defaultArgument?.toString(),
|
||||||
'default_client_dart': column.clientDefaultCode,
|
'default_client_dart': column.clientDefaultCode?.toString(),
|
||||||
'dsl_features': [...column.constraints.map(_dslFeatureData)],
|
'dsl_features': [...column.constraints.map(_dslFeatureData)],
|
||||||
if (column.typeConverter != null)
|
if (column.typeConverter != null)
|
||||||
'type_converter': {
|
'type_converter': {
|
||||||
|
@ -313,6 +313,7 @@ class SchemaReader {
|
||||||
_declaration,
|
_declaration,
|
||||||
columns: columns,
|
columns: columns,
|
||||||
baseDartName: pascalCase,
|
baseDartName: pascalCase,
|
||||||
|
fixedEntityInfoName: pascalCase,
|
||||||
nameOfRowClass: '${pascalCase}Data',
|
nameOfRowClass: '${pascalCase}Data',
|
||||||
writeDefaultConstraints: true,
|
writeDefaultConstraints: true,
|
||||||
withoutRowId: withoutRowId,
|
withoutRowId: withoutRowId,
|
||||||
|
@ -349,6 +350,7 @@ class SchemaReader {
|
||||||
_declaration,
|
_declaration,
|
||||||
columns: columns,
|
columns: columns,
|
||||||
baseDartName: pascalCase,
|
baseDartName: pascalCase,
|
||||||
|
fixedEntityInfoName: pascalCase,
|
||||||
nameOfRowClass: '${pascalCase}Data',
|
nameOfRowClass: '${pascalCase}Data',
|
||||||
writeDefaultConstraints: content['was_declared_in_moor'] != true,
|
writeDefaultConstraints: content['was_declared_in_moor'] != true,
|
||||||
withoutRowId: withoutRowId,
|
withoutRowId: withoutRowId,
|
||||||
|
@ -394,6 +396,9 @@ class SchemaReader {
|
||||||
].whereType<DriftColumnConstraint>().toList();
|
].whereType<DriftColumnConstraint>().toList();
|
||||||
final getterName = data['getter_name'] as String?;
|
final getterName = data['getter_name'] as String?;
|
||||||
|
|
||||||
|
final defaultDart = data['default_dart'] as String?;
|
||||||
|
final defaultClientDart = data['default_client_dart'] as String?;
|
||||||
|
|
||||||
// Note: Not including client default code because that usually depends on
|
// Note: Not including client default code because that usually depends on
|
||||||
// imports from the database.
|
// imports from the database.
|
||||||
return DriftColumn(
|
return DriftColumn(
|
||||||
|
@ -401,6 +406,11 @@ class SchemaReader {
|
||||||
nullable: nullable,
|
nullable: nullable,
|
||||||
nameInSql: name,
|
nameInSql: name,
|
||||||
nameInDart: getterName ?? ReCase(name).camelCase,
|
nameInDart: getterName ?? ReCase(name).camelCase,
|
||||||
|
defaultArgument:
|
||||||
|
defaultDart != null ? AnnotatedDartCode([defaultDart]) : null,
|
||||||
|
clientDefaultCode: defaultClientDart != null
|
||||||
|
? AnnotatedDartCode([defaultClientDart])
|
||||||
|
: null,
|
||||||
declaration: _declaration,
|
declaration: _declaration,
|
||||||
customConstraints: customConstraints,
|
customConstraints: customConstraints,
|
||||||
constraints: dslFeatures,
|
constraints: dslFeatures,
|
||||||
|
|
|
@ -50,6 +50,8 @@ String defaultConstraints(DriftColumn column) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConstraints.add(constraint);
|
defaultConstraints.add(constraint);
|
||||||
|
} else if (feature is DefaultConstraintsFromSchemaFile) {
|
||||||
|
return feature.constraints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV1 extends GeneratedDatabase {
|
class DatabaseAtV1 extends GeneratedDatabase {
|
||||||
|
|
|
@ -32,9 +32,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV2 extends GeneratedDatabase {
|
class DatabaseAtV2 extends GeneratedDatabase {
|
||||||
|
|
|
@ -32,9 +32,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
|
|
@ -34,9 +34,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
|
|
@ -39,9 +39,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
@ -106,7 +103,8 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -42,9 +42,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
@ -110,7 +107,8 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -42,9 +42,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
@ -97,51 +94,6 @@ class Groups extends Table with TableInfo {
|
||||||
bool get dontWriteConstraints => true;
|
bool get dontWriteConstraints => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Notes extends Table with TableInfo, VirtualTableInfo {
|
|
||||||
@override
|
|
||||||
final GeneratedDatabase attachedDatabase;
|
|
||||||
final String? _alias;
|
|
||||||
Notes(this.attachedDatabase, [this._alias]);
|
|
||||||
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
||||||
'title', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
late final GeneratedColumn<String> content = GeneratedColumn<String>(
|
|
||||||
'content', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
late final GeneratedColumn<String> searchTerms = GeneratedColumn<String>(
|
|
||||||
'search_terms', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns => [title, content, searchTerms];
|
|
||||||
@override
|
|
||||||
String get aliasedName => _alias ?? 'notes';
|
|
||||||
@override
|
|
||||||
String get actualTableName => 'notes';
|
|
||||||
@override
|
|
||||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
|
||||||
@override
|
|
||||||
Never map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
||||||
throw UnsupportedError('TableInfo.map in schema verification code');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Notes createAlias(String alias) {
|
|
||||||
return Notes(attachedDatabase, alias);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => true;
|
|
||||||
@override
|
|
||||||
String get moduleAndArgs =>
|
|
||||||
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
|
||||||
}
|
|
||||||
|
|
||||||
class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
@override
|
@override
|
||||||
|
@ -155,7 +107,8 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
@ -188,6 +141,49 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
Set<String> get readTables => const {};
|
Set<String> get readTables => const {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Notes extends Table with TableInfo, VirtualTableInfo {
|
||||||
|
@override
|
||||||
|
final GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
Notes(this.attachedDatabase, [this._alias]);
|
||||||
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
|
'title', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
late final GeneratedColumn<String> content = GeneratedColumn<String>(
|
||||||
|
'content', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
late final GeneratedColumn<String> searchTerms = GeneratedColumn<String>(
|
||||||
|
'search_terms', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
@override
|
||||||
|
List<GeneratedColumn> get $columns => [title, content, searchTerms];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? 'notes';
|
||||||
|
@override
|
||||||
|
String get actualTableName => 'notes';
|
||||||
|
@override
|
||||||
|
Set<GeneratedColumn> get $primaryKey => const <GeneratedColumn>{};
|
||||||
|
@override
|
||||||
|
Never map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
throw UnsupportedError('TableInfo.map in schema verification code');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Notes createAlias(String alias) {
|
||||||
|
return Notes(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get moduleAndArgs =>
|
||||||
|
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
||||||
|
}
|
||||||
|
|
||||||
class DatabaseAtV7 extends GeneratedDatabase {
|
class DatabaseAtV7 extends GeneratedDatabase {
|
||||||
DatabaseAtV7(QueryExecutor e) : super(e);
|
DatabaseAtV7(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV7.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV7.connect(DatabaseConnection c) : super.connect(c);
|
||||||
|
|
|
@ -46,9 +46,6 @@ class Users extends Table with TableInfo {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Groups extends Table with TableInfo {
|
class Groups extends Table with TableInfo {
|
||||||
|
@ -101,51 +98,6 @@ class Groups extends Table with TableInfo {
|
||||||
bool get dontWriteConstraints => true;
|
bool get dontWriteConstraints => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Notes extends Table with TableInfo, VirtualTableInfo {
|
|
||||||
@override
|
|
||||||
final GeneratedDatabase attachedDatabase;
|
|
||||||
final String? _alias;
|
|
||||||
Notes(this.attachedDatabase, [this._alias]);
|
|
||||||
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
||||||
'title', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
late final GeneratedColumn<String> content = GeneratedColumn<String>(
|
|
||||||
'content', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
late final GeneratedColumn<String> searchTerms = GeneratedColumn<String>(
|
|
||||||
'search_terms', aliasedName, false,
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true,
|
|
||||||
$customConstraints: '');
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns => [title, content, searchTerms];
|
|
||||||
@override
|
|
||||||
String get aliasedName => _alias ?? 'notes';
|
|
||||||
@override
|
|
||||||
String get actualTableName => 'notes';
|
|
||||||
@override
|
|
||||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
|
||||||
@override
|
|
||||||
Never map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
||||||
throw UnsupportedError('TableInfo.map in schema verification code');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Notes createAlias(String alias) {
|
|
||||||
return Notes(attachedDatabase, alias);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => true;
|
|
||||||
@override
|
|
||||||
String get moduleAndArgs =>
|
|
||||||
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
|
||||||
}
|
|
||||||
|
|
||||||
class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
final String? _alias;
|
final String? _alias;
|
||||||
@override
|
@override
|
||||||
|
@ -159,7 +111,8 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
@ -192,6 +145,49 @@ class GroupCount extends ViewInfo<GroupCount, Never> implements HasResultSet {
|
||||||
Set<String> get readTables => const {};
|
Set<String> get readTables => const {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Notes extends Table with TableInfo, VirtualTableInfo {
|
||||||
|
@override
|
||||||
|
final GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
Notes(this.attachedDatabase, [this._alias]);
|
||||||
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
||||||
|
'title', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
late final GeneratedColumn<String> content = GeneratedColumn<String>(
|
||||||
|
'content', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
late final GeneratedColumn<String> searchTerms = GeneratedColumn<String>(
|
||||||
|
'search_terms', aliasedName, false,
|
||||||
|
type: DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
$customConstraints: '');
|
||||||
|
@override
|
||||||
|
List<GeneratedColumn> get $columns => [title, content, searchTerms];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? 'notes';
|
||||||
|
@override
|
||||||
|
String get actualTableName => 'notes';
|
||||||
|
@override
|
||||||
|
Set<GeneratedColumn> get $primaryKey => const <GeneratedColumn>{};
|
||||||
|
@override
|
||||||
|
Never map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
throw UnsupportedError('TableInfo.map in schema verification code');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Notes createAlias(String alias) {
|
||||||
|
return Notes(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get moduleAndArgs =>
|
||||||
|
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
||||||
|
}
|
||||||
|
|
||||||
class DatabaseAtV8 extends GeneratedDatabase {
|
class DatabaseAtV8 extends GeneratedDatabase {
|
||||||
DatabaseAtV8(QueryExecutor e) : super(e);
|
DatabaseAtV8(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV8.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV8.connect(DatabaseConnection c) : super.connect(c);
|
||||||
|
|
|
@ -122,9 +122,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV1 extends GeneratedDatabase {
|
class DatabaseAtV1 extends GeneratedDatabase {
|
||||||
|
|
|
@ -145,9 +145,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseAtV2 extends GeneratedDatabase {
|
class DatabaseAtV2 extends GeneratedDatabase {
|
||||||
|
|
|
@ -145,9 +145,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
|
|
@ -147,9 +147,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
|
|
@ -183,9 +183,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
@ -489,7 +486,8 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -215,9 +215,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
@ -530,7 +527,8 @@ class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
@override
|
@override
|
||||||
String get entityName => 'group_count';
|
String get entityName => 'group_count';
|
||||||
@override
|
@override
|
||||||
String? get createViewStmt => null;
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
@override
|
@override
|
||||||
GroupCount get asDslTable => this;
|
GroupCount get asDslTable => this;
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -215,9 +215,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
@ -443,6 +440,139 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
bool get dontWriteConstraints => true;
|
bool get dontWriteConstraints => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GroupCountData extends DataClass {
|
||||||
|
final int id;
|
||||||
|
final String name;
|
||||||
|
final DateTime? birthday;
|
||||||
|
final int? nextUser;
|
||||||
|
final int groupCount;
|
||||||
|
const GroupCountData(
|
||||||
|
{required this.id,
|
||||||
|
required this.name,
|
||||||
|
this.birthday,
|
||||||
|
this.nextUser,
|
||||||
|
required this.groupCount});
|
||||||
|
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
||||||
|
{ValueSerializer? serializer}) {
|
||||||
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
return GroupCountData(
|
||||||
|
id: serializer.fromJson<int>(json['id']),
|
||||||
|
name: serializer.fromJson<String>(json['name']),
|
||||||
|
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
||||||
|
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
||||||
|
groupCount: serializer.fromJson<int>(json['groupCount']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||||
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'id': serializer.toJson<int>(id),
|
||||||
|
'name': serializer.toJson<String>(name),
|
||||||
|
'birthday': serializer.toJson<DateTime?>(birthday),
|
||||||
|
'nextUser': serializer.toJson<int?>(nextUser),
|
||||||
|
'groupCount': serializer.toJson<int>(groupCount),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupCountData copyWith(
|
||||||
|
{int? id,
|
||||||
|
String? name,
|
||||||
|
Value<DateTime?> birthday = const Value.absent(),
|
||||||
|
Value<int?> nextUser = const Value.absent(),
|
||||||
|
int? groupCount}) =>
|
||||||
|
GroupCountData(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
birthday: birthday.present ? birthday.value : this.birthday,
|
||||||
|
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
||||||
|
groupCount: groupCount ?? this.groupCount,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('GroupCountData(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('birthday: $birthday, ')
|
||||||
|
..write('nextUser: $nextUser, ')
|
||||||
|
..write('groupCount: $groupCount')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is GroupCountData &&
|
||||||
|
other.id == this.id &&
|
||||||
|
other.name == this.name &&
|
||||||
|
other.birthday == this.birthday &&
|
||||||
|
other.nextUser == this.nextUser &&
|
||||||
|
other.groupCount == this.groupCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
|
implements HasResultSet {
|
||||||
|
final String? _alias;
|
||||||
|
@override
|
||||||
|
final DatabaseAtV7 attachedDatabase;
|
||||||
|
GroupCount(this.attachedDatabase, [this._alias]);
|
||||||
|
@override
|
||||||
|
List<GeneratedColumn> get $columns =>
|
||||||
|
[id, name, birthday, nextUser, groupCount];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? entityName;
|
||||||
|
@override
|
||||||
|
String get entityName => 'group_count';
|
||||||
|
@override
|
||||||
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
|
@override
|
||||||
|
GroupCount get asDslTable => this;
|
||||||
|
@override
|
||||||
|
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return GroupCountData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
birthday: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
groupCount: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final GeneratedColumn<int> id =
|
||||||
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
||||||
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
|
'name', aliasedName, false,
|
||||||
|
type: DriftSqlType.string);
|
||||||
|
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
||||||
|
'birthday', aliasedName, true,
|
||||||
|
type: DriftSqlType.dateTime);
|
||||||
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
|
'next_user', aliasedName, true,
|
||||||
|
type: DriftSqlType.int);
|
||||||
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
||||||
|
'group_count', aliasedName, false,
|
||||||
|
type: DriftSqlType.int);
|
||||||
|
@override
|
||||||
|
GroupCount createAlias(String alias) {
|
||||||
|
return GroupCount(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Query? get query => null;
|
||||||
|
@override
|
||||||
|
Set<String> get readTables => const {};
|
||||||
|
}
|
||||||
|
|
||||||
class NotesData extends DataClass implements Insertable<NotesData> {
|
class NotesData extends DataClass implements Insertable<NotesData> {
|
||||||
final String title;
|
final String title;
|
||||||
final String content;
|
final String content;
|
||||||
|
@ -605,7 +735,7 @@ class Notes extends Table
|
||||||
@override
|
@override
|
||||||
String get actualTableName => 'notes';
|
String get actualTableName => 'notes';
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
Set<GeneratedColumn> get $primaryKey => const <GeneratedColumn>{};
|
||||||
@override
|
@override
|
||||||
NotesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
NotesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
@ -624,145 +754,11 @@ class Notes extends Table
|
||||||
return Notes(attachedDatabase, alias);
|
return Notes(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => true;
|
|
||||||
@override
|
@override
|
||||||
String get moduleAndArgs =>
|
String get moduleAndArgs =>
|
||||||
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupCountData extends DataClass {
|
|
||||||
final int id;
|
|
||||||
final String name;
|
|
||||||
final DateTime? birthday;
|
|
||||||
final int? nextUser;
|
|
||||||
final int groupCount;
|
|
||||||
const GroupCountData(
|
|
||||||
{required this.id,
|
|
||||||
required this.name,
|
|
||||||
this.birthday,
|
|
||||||
this.nextUser,
|
|
||||||
required this.groupCount});
|
|
||||||
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
|
||||||
{ValueSerializer? serializer}) {
|
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
||||||
return GroupCountData(
|
|
||||||
id: serializer.fromJson<int>(json['id']),
|
|
||||||
name: serializer.fromJson<String>(json['name']),
|
|
||||||
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
|
||||||
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
|
||||||
groupCount: serializer.fromJson<int>(json['groupCount']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
||||||
return <String, dynamic>{
|
|
||||||
'id': serializer.toJson<int>(id),
|
|
||||||
'name': serializer.toJson<String>(name),
|
|
||||||
'birthday': serializer.toJson<DateTime?>(birthday),
|
|
||||||
'nextUser': serializer.toJson<int?>(nextUser),
|
|
||||||
'groupCount': serializer.toJson<int>(groupCount),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupCountData copyWith(
|
|
||||||
{int? id,
|
|
||||||
String? name,
|
|
||||||
Value<DateTime?> birthday = const Value.absent(),
|
|
||||||
Value<int?> nextUser = const Value.absent(),
|
|
||||||
int? groupCount}) =>
|
|
||||||
GroupCountData(
|
|
||||||
id: id ?? this.id,
|
|
||||||
name: name ?? this.name,
|
|
||||||
birthday: birthday.present ? birthday.value : this.birthday,
|
|
||||||
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
|
||||||
groupCount: groupCount ?? this.groupCount,
|
|
||||||
);
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return (StringBuffer('GroupCountData(')
|
|
||||||
..write('id: $id, ')
|
|
||||||
..write('name: $name, ')
|
|
||||||
..write('birthday: $birthday, ')
|
|
||||||
..write('nextUser: $nextUser, ')
|
|
||||||
..write('groupCount: $groupCount')
|
|
||||||
..write(')'))
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount);
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
(other is GroupCountData &&
|
|
||||||
other.id == this.id &&
|
|
||||||
other.name == this.name &&
|
|
||||||
other.birthday == this.birthday &&
|
|
||||||
other.nextUser == this.nextUser &&
|
|
||||||
other.groupCount == this.groupCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
|
||||||
implements HasResultSet {
|
|
||||||
final String? _alias;
|
|
||||||
@override
|
|
||||||
final DatabaseAtV7 attachedDatabase;
|
|
||||||
GroupCount(this.attachedDatabase, [this._alias]);
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns =>
|
|
||||||
[id, name, birthday, nextUser, groupCount];
|
|
||||||
@override
|
|
||||||
String get aliasedName => _alias ?? entityName;
|
|
||||||
@override
|
|
||||||
String get entityName => 'group_count';
|
|
||||||
@override
|
|
||||||
String? get createViewStmt => null;
|
|
||||||
@override
|
|
||||||
GroupCount get asDslTable => this;
|
|
||||||
@override
|
|
||||||
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
||||||
return GroupCountData(
|
|
||||||
id: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
||||||
name: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
|
||||||
birthday: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
|
||||||
nextUser: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
|
||||||
groupCount: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final GeneratedColumn<int> id =
|
|
||||||
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
|
||||||
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
||||||
'name', aliasedName, false,
|
|
||||||
type: DriftSqlType.string);
|
|
||||||
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
|
||||||
'birthday', aliasedName, true,
|
|
||||||
type: DriftSqlType.dateTime);
|
|
||||||
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
|
||||||
'next_user', aliasedName, true,
|
|
||||||
type: DriftSqlType.int);
|
|
||||||
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
|
||||||
'group_count', aliasedName, false,
|
|
||||||
type: DriftSqlType.int);
|
|
||||||
@override
|
|
||||||
GroupCount createAlias(String alias) {
|
|
||||||
return GroupCount(attachedDatabase, alias);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Query? get query => null;
|
|
||||||
@override
|
|
||||||
Set<String> get readTables => const {};
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatabaseAtV7 extends GeneratedDatabase {
|
class DatabaseAtV7 extends GeneratedDatabase {
|
||||||
DatabaseAtV7(QueryExecutor e) : super(e);
|
DatabaseAtV7(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV7.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV7.connect(DatabaseConnection c) : super.connect(c);
|
||||||
|
|
|
@ -219,9 +219,6 @@ class Users extends Table with TableInfo<Users, UsersData> {
|
||||||
Users createAlias(String alias) {
|
Users createAlias(String alias) {
|
||||||
return Users(attachedDatabase, alias);
|
return Users(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
||||||
|
@ -447,6 +444,139 @@ class Groups extends Table with TableInfo<Groups, GroupsData> {
|
||||||
bool get dontWriteConstraints => true;
|
bool get dontWriteConstraints => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GroupCountData extends DataClass {
|
||||||
|
final int id;
|
||||||
|
final String name;
|
||||||
|
final DateTime? birthday;
|
||||||
|
final int? nextUser;
|
||||||
|
final int groupCount;
|
||||||
|
const GroupCountData(
|
||||||
|
{required this.id,
|
||||||
|
required this.name,
|
||||||
|
this.birthday,
|
||||||
|
this.nextUser,
|
||||||
|
required this.groupCount});
|
||||||
|
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
||||||
|
{ValueSerializer? serializer}) {
|
||||||
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
return GroupCountData(
|
||||||
|
id: serializer.fromJson<int>(json['id']),
|
||||||
|
name: serializer.fromJson<String>(json['name']),
|
||||||
|
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
||||||
|
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
||||||
|
groupCount: serializer.fromJson<int>(json['groupCount']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||||
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'id': serializer.toJson<int>(id),
|
||||||
|
'name': serializer.toJson<String>(name),
|
||||||
|
'birthday': serializer.toJson<DateTime?>(birthday),
|
||||||
|
'nextUser': serializer.toJson<int?>(nextUser),
|
||||||
|
'groupCount': serializer.toJson<int>(groupCount),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupCountData copyWith(
|
||||||
|
{int? id,
|
||||||
|
String? name,
|
||||||
|
Value<DateTime?> birthday = const Value.absent(),
|
||||||
|
Value<int?> nextUser = const Value.absent(),
|
||||||
|
int? groupCount}) =>
|
||||||
|
GroupCountData(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
birthday: birthday.present ? birthday.value : this.birthday,
|
||||||
|
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
||||||
|
groupCount: groupCount ?? this.groupCount,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('GroupCountData(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('birthday: $birthday, ')
|
||||||
|
..write('nextUser: $nextUser, ')
|
||||||
|
..write('groupCount: $groupCount')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is GroupCountData &&
|
||||||
|
other.id == this.id &&
|
||||||
|
other.name == this.name &&
|
||||||
|
other.birthday == this.birthday &&
|
||||||
|
other.nextUser == this.nextUser &&
|
||||||
|
other.groupCount == this.groupCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
||||||
|
implements HasResultSet {
|
||||||
|
final String? _alias;
|
||||||
|
@override
|
||||||
|
final DatabaseAtV8 attachedDatabase;
|
||||||
|
GroupCount(this.attachedDatabase, [this._alias]);
|
||||||
|
@override
|
||||||
|
List<GeneratedColumn> get $columns =>
|
||||||
|
[id, name, birthday, nextUser, groupCount];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? entityName;
|
||||||
|
@override
|
||||||
|
String get entityName => 'group_count';
|
||||||
|
@override
|
||||||
|
String get createViewStmt =>
|
||||||
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users';
|
||||||
|
@override
|
||||||
|
GroupCount get asDslTable => this;
|
||||||
|
@override
|
||||||
|
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return GroupCountData(
|
||||||
|
id: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
birthday: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
||||||
|
nextUser: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
||||||
|
groupCount: attachedDatabase.options.types
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final GeneratedColumn<int> id =
|
||||||
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
||||||
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
||||||
|
'name', aliasedName, false,
|
||||||
|
type: DriftSqlType.string);
|
||||||
|
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
||||||
|
'birthday', aliasedName, true,
|
||||||
|
type: DriftSqlType.dateTime);
|
||||||
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
||||||
|
'next_user', aliasedName, true,
|
||||||
|
type: DriftSqlType.int);
|
||||||
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
||||||
|
'group_count', aliasedName, false,
|
||||||
|
type: DriftSqlType.int);
|
||||||
|
@override
|
||||||
|
GroupCount createAlias(String alias) {
|
||||||
|
return GroupCount(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Query? get query => null;
|
||||||
|
@override
|
||||||
|
Set<String> get readTables => const {};
|
||||||
|
}
|
||||||
|
|
||||||
class NotesData extends DataClass implements Insertable<NotesData> {
|
class NotesData extends DataClass implements Insertable<NotesData> {
|
||||||
final String title;
|
final String title;
|
||||||
final String content;
|
final String content;
|
||||||
|
@ -609,7 +739,7 @@ class Notes extends Table
|
||||||
@override
|
@override
|
||||||
String get actualTableName => 'notes';
|
String get actualTableName => 'notes';
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
Set<GeneratedColumn> get $primaryKey => const <GeneratedColumn>{};
|
||||||
@override
|
@override
|
||||||
NotesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
NotesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
@ -628,145 +758,11 @@ class Notes extends Table
|
||||||
return Notes(attachedDatabase, alias);
|
return Notes(attachedDatabase, alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
bool get dontWriteConstraints => true;
|
|
||||||
@override
|
@override
|
||||||
String get moduleAndArgs =>
|
String get moduleAndArgs =>
|
||||||
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupCountData extends DataClass {
|
|
||||||
final int id;
|
|
||||||
final String name;
|
|
||||||
final DateTime? birthday;
|
|
||||||
final int? nextUser;
|
|
||||||
final int groupCount;
|
|
||||||
const GroupCountData(
|
|
||||||
{required this.id,
|
|
||||||
required this.name,
|
|
||||||
this.birthday,
|
|
||||||
this.nextUser,
|
|
||||||
required this.groupCount});
|
|
||||||
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
|
||||||
{ValueSerializer? serializer}) {
|
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
||||||
return GroupCountData(
|
|
||||||
id: serializer.fromJson<int>(json['id']),
|
|
||||||
name: serializer.fromJson<String>(json['name']),
|
|
||||||
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
|
||||||
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
|
||||||
groupCount: serializer.fromJson<int>(json['groupCount']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
||||||
return <String, dynamic>{
|
|
||||||
'id': serializer.toJson<int>(id),
|
|
||||||
'name': serializer.toJson<String>(name),
|
|
||||||
'birthday': serializer.toJson<DateTime?>(birthday),
|
|
||||||
'nextUser': serializer.toJson<int?>(nextUser),
|
|
||||||
'groupCount': serializer.toJson<int>(groupCount),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupCountData copyWith(
|
|
||||||
{int? id,
|
|
||||||
String? name,
|
|
||||||
Value<DateTime?> birthday = const Value.absent(),
|
|
||||||
Value<int?> nextUser = const Value.absent(),
|
|
||||||
int? groupCount}) =>
|
|
||||||
GroupCountData(
|
|
||||||
id: id ?? this.id,
|
|
||||||
name: name ?? this.name,
|
|
||||||
birthday: birthday.present ? birthday.value : this.birthday,
|
|
||||||
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
|
||||||
groupCount: groupCount ?? this.groupCount,
|
|
||||||
);
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return (StringBuffer('GroupCountData(')
|
|
||||||
..write('id: $id, ')
|
|
||||||
..write('name: $name, ')
|
|
||||||
..write('birthday: $birthday, ')
|
|
||||||
..write('nextUser: $nextUser, ')
|
|
||||||
..write('groupCount: $groupCount')
|
|
||||||
..write(')'))
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount);
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
(other is GroupCountData &&
|
|
||||||
other.id == this.id &&
|
|
||||||
other.name == this.name &&
|
|
||||||
other.birthday == this.birthday &&
|
|
||||||
other.nextUser == this.nextUser &&
|
|
||||||
other.groupCount == this.groupCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
|
||||||
implements HasResultSet {
|
|
||||||
final String? _alias;
|
|
||||||
@override
|
|
||||||
final DatabaseAtV8 attachedDatabase;
|
|
||||||
GroupCount(this.attachedDatabase, [this._alias]);
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns =>
|
|
||||||
[id, name, birthday, nextUser, groupCount];
|
|
||||||
@override
|
|
||||||
String get aliasedName => _alias ?? entityName;
|
|
||||||
@override
|
|
||||||
String get entityName => 'group_count';
|
|
||||||
@override
|
|
||||||
String? get createViewStmt => null;
|
|
||||||
@override
|
|
||||||
GroupCount get asDslTable => this;
|
|
||||||
@override
|
|
||||||
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
||||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
||||||
return GroupCountData(
|
|
||||||
id: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
||||||
name: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
|
||||||
birthday: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
|
||||||
nextUser: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
|
||||||
groupCount: attachedDatabase.options.types
|
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final GeneratedColumn<int> id =
|
|
||||||
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
|
||||||
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
||||||
'name', aliasedName, false,
|
|
||||||
type: DriftSqlType.string);
|
|
||||||
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
|
||||||
'birthday', aliasedName, true,
|
|
||||||
type: DriftSqlType.dateTime);
|
|
||||||
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
|
||||||
'next_user', aliasedName, true,
|
|
||||||
type: DriftSqlType.int);
|
|
||||||
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
|
||||||
'group_count', aliasedName, false,
|
|
||||||
type: DriftSqlType.int);
|
|
||||||
@override
|
|
||||||
GroupCount createAlias(String alias) {
|
|
||||||
return GroupCount(attachedDatabase, alias);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Query? get query => null;
|
|
||||||
@override
|
|
||||||
Set<String> get readTables => const {};
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatabaseAtV8 extends GeneratedDatabase {
|
class DatabaseAtV8 extends GeneratedDatabase {
|
||||||
DatabaseAtV8(QueryExecutor e) : super(e);
|
DatabaseAtV8(QueryExecutor e) : super(e);
|
||||||
DatabaseAtV8.connect(DatabaseConnection c) : super.connect(c);
|
DatabaseAtV8.connect(DatabaseConnection c) : super.connect(c);
|
||||||
|
|
Loading…
Reference in New Issue