Skip to content
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

A table having foreign key reference which is not reflected in a custom data class throws an error #3335

Open
AhmedLSayed9 opened this issue Nov 12, 2024 · 0 comments

Comments

@AhmedLSayed9
Copy link
Contributor

As per docs: A table can have additional columns not reflected in a custom data class. Drift will simply not load those columns when mapping a row.

Despite that, the following code can't run:

class AnotherTable extends Table {
  IntColumn get id => integer().autoIncrement()();
}

@UseRowClass(Item)
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 throws the following error: Error: The getter 'anotherTable' isn't defined for the class 'Item'.

@AhmedLSayed9 AhmedLSayed9 changed the title A table having additional foreign key reference column not reflected in a custom data class throws an error A table having foreign key reference which is not reflected in a custom data class throws an error Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant