drift
drift copied to clipboard
Allow the generated Insertable to work with manager references around custom row classes
If we try to build the generated code for the following tables:
class AnotherTable extends Table {
IntColumn get id => integer().autoIncrement()();
}
@UseRowClass(Item, generateInsertable: true)
class Items extends Table {
IntColumn get id => integer().autoIncrement()();
IntColumn get anotherTable => integer().references(AnotherTable, #id)();
}
class Item {
Item({required this.id});
final int id;
}
It will throw a warning: This class used as a custom row class for which an insertable is generated. This means that it must define getters for all columns, but some are missing: anotherTable
It would be great if we can support generating toColumns which requires passing anotherTable to make that work.
So, user will be able to use toInsertable as following:
item.toInsertable(anotherTable: someId)