You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a non-orm serializable as a column, source_gen triggers a warning that leads to migration fail:
// simplified example
@orm
@serializable
abstract class _User extends Model {
String get name;
_Profile? get profile;
}
@serializable
abstract class _Profile {
String get firstName;
String get lastName;
}
Running build_runner succeeds with the following warning:
[INFO] ------------------------------------------------------------------------
[INFO] Starting Build
[INFO] Updating asset graph completed, took 2ms
[WARNING] angel3_orm_generator:angel3_orm on lib/src/models/models.dart:
Cannot generate ORM code for field profile of type _Profile?
[INFO] Running build completed, took 1.8s
[INFO] Caching finalized dependency graph completed, took 40ms
[INFO] Succeeded after 1.9s with 2 outputs (2 actions)
And then when I try to run dart bin/migrate.dart up I get the following error:
../core/lib/src/models/models.g.dart:1020:7: Error: The getter 'profile' isn't defined for the class 'UserQueryWhere'.
- 'UserQueryWhere' is from 'package:core/src/models/models.dart' ('../core/lib/src/models/models.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'profile'.
profile,
^^^^^^^
What am I missing here? The point is to use a serializable class for a jsonb column, but the generator seems to want to be able to query using that jsonb field. Any hints to what I'm doing wrong would be really appreciated. Thanks.
The text was updated successfully, but these errors were encountered:
The jsonb data type can be done as follows. The @Column annotation is optional. Just added it for clarity. @serializable annotation is not designed to work with jsonb object. Check out the test case has_map_test.dart under angel_orm_test folder.
When using a non-orm
serializable
as a column, source_gen triggers a warning that leads to migration fail:Running build_runner succeeds with the following warning:
And then when I try to run
dart bin/migrate.dart up
I get the following error:What am I missing here? The point is to use a serializable class for a jsonb column, but the generator seems to want to be able to query using that jsonb field. Any hints to what I'm doing wrong would be really appreciated. Thanks.
The text was updated successfully, but these errors were encountered: