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

angel3_orm MySQL/MariaDB auto increment #122

Open
Garthi opened this issue Apr 9, 2024 · 3 comments
Open

angel3_orm MySQL/MariaDB auto increment #122

Garthi opened this issue Apr 9, 2024 · 3 comments

Comments

@Garthi
Copy link

Garthi commented Apr 9, 2024

Hello, we are currently searching for an ORM plugin for our new DART project and we tested the angel3_orm. But we can't find an auto increment definition for the entity.

Does it really not exist in your ORM or did we just not find the correct way to implement it? Could you give me some feedback regarding this matter? Thank you!

@dukefirehawk
Copy link
Collaborator

Have you tried the following?

@primayKey
int? id;

Take a look at the examples in packages/orm/angel_orm_test.

@Garthi
Copy link
Author

Garthi commented Apr 23, 2024

Hi, we found two solutions one is

  @Column(type: ColumnType.serial, indexType: IndexType.primaryKey)
  int? get id;

but with this version you can't add references, then the type alias generates a big int
the second solution is

  @Column(type: ColumnType.int, indexType: IndexType.primaryKey, length: 10, defaultValue: 'NULL AUTO_INCREMENT')
  int? get id;

this version is a bit hacki but is works for us :-)

@dukefirehawk
Copy link
Collaborator

The first solution should work. Will schedule it to be fixed.

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

2 participants