angel-dart / angel

[ARCHIVED] A polished, production-ready backend framework in Dart for the VM, AOT, and Flutter.
https://angel-dart.dev/
MIT License
1.06k stars 67 forks source link

Foreign key indexing and not-null #224

Closed thosakwe closed 3 years ago

thosakwe commented 4 years ago

This issue was originally created by @sanmadjack here, before being automatically moved: https://github.com/angel-dart-archive/orm/issues/76


I want to add a relationship that is mandatory, but this doesn't result in the linking column being not null:

  @Column(isNullable: false, indexType: IndexType.standardIndex)
  @BelongsTo()
  _ImportBatch get importBatch;

Additionally, it does not produce an index on the index column. How can I do these things?

thosakwe commented 4 years ago

@thosakwe commented:

Hmm... See what happens if you add a @notNull annotation.

thosakwe commented 4 years ago

@sanmadjack commented:

Changed to:

  @Column(indexType: IndexType.standardIndex)
  @BelongsTo()
  @notNull
  _ImportBatch get importBatch;

migrate refreshed and the foreign key column is still set to allow nulls.

thosakwe commented 4 years ago

@sanmadjack commented:

I'm currently running: angel_orm 2.0.0 angel_orm_generator 2.0.4 angel_orm_postgres 1.0.0

thosakwe commented 4 years ago

@thosakwe commented:

Thanks. I'll likely be able to roll out a fix for this tonight, but at the moment, I'm currently studying.

thosakwe commented 4 years ago

@sanmadjack commented:

I'm willing to help out to code some of this stuff if you point me at the package that it would need addressed in.

thosakwe commented 4 years ago

@thosakwe commented:

Are you still getting this error?