-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrations 2.7 => 2.19, unlogic errors #3149
Comments
:) |
This was a regression from a while ago and will be fixed in the next drift version. You can also use a
Note that the snippet you've posted has a syntax error: @UseRowClass(Filter)
-FilterDataClass extends Table {
+class FilterDataClass extends Table { I can't reproduce the issue with the fix applied. |
Ok thanks @simolus3, noted for the 1st point ! For the 2nd point, it's just a copy-paste error in the example :)
It's strange but not blocking ... |
So you only get the "is not understood by drift" warning now? Is there anything you're doing differently to me here? I can't reproduce the issue with this file: import 'package:drift/drift.dart';
part 'repro.g.dart';
@UseRowClass(CompleteEntityFilter)
class CompleteEntityFilterDataClass extends Table {
IntColumn get id => integer().autoIncrement().nullable()();
TextColumn get label => text().nullable()();
IntColumn get typeListToFilterId => integer()();
}
class CompleteEntityFilter {
CompleteEntityFilter({
this.id,
this.label,
required this.typeListToFilterId,
});
CompleteEntityFilter.withFilters({
this.id,
required this.typeListToFilterId,
this.filters,
});
int? id;
String? label;
int typeListToFilterId;
List<Filter>? filters;
}
@UseRowClass(Filter)
class FilterDataClass extends Table {
IntColumn get id => integer().autoIncrement()();
IntColumn get completeFilterId =>
integer().references(CompleteEntityFilterDataClass, #id,
onUpdate: KeyAction.cascade, onDelete: KeyAction.cascade)();
IntColumn get typeFilterSortId => integer()();
}
class Filter {
Filter({
this.id,
this.completeFilterId,
required this.typeFilterSortId,
});
int? id;
int? completeFilterId;
int typeFilterSortId;
}
@DriftDatabase(tables: [FilterDataClass, CompleteEntityFilterDataClass])
class Database extends _$Database {
Database(super.e);
@override
int get schemaVersion => 1;
} |
Hello,
I just updated Drift (I went from 2.7.0 to 2.19.1), and it created 2 incomprehensible errors for me. I specify that everything worked well in 2.7
1 - I can not have the word "Menus" in the name of a Table (I had the case with 2 tables having this word in their name)
Example:
Error message in console when building the generated files:
[SEVERE] drift_dev on lib/core/data/tables/menus.dart (cached): type 'Null' is not a subtype of type 'InterfaceElement' in type cast
Errors in my generated database file:
$MainMenusTable extends ... :
Missing concrete implementations of 'Table.blob', 'Table.boolean', 'Table.customType', 'Table.dateTime', and 11 more.
TableInfo :
'TableInfo<$MainMenusTable, MainMenus>' can't be mixed onto 'MainMenus' because 'MainMenus' doesn't implement 'Table'.
$MainMenusTable(...) :
The implicitly invoked unnamed constructor from 'MainMenus' has required parameters.
id :
'$MainMenusTable.id' ('GeneratedColumn<int> Function()') isn't a valid override of 'MainMenus.id' ('int Function()').
If I just remove the 'u', I no longer have any errors.
2 - I have a warning on a reference that uses @UseRowClass, but I really do not understand why. I need to have custom classes, here I have hidden the methods because they are not useful in this problem.
Warning message in console :
Code :
Do you know why these errors occur?
BR,
The text was updated successfully, but these errors were encountered: