-
Notifications
You must be signed in to change notification settings - Fork 286
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
can't use @Index decorator with indexes at the model options #1720
Comments
callmeteus
added a commit
to callmeteus/sequelize-typescript
that referenced
this issue
Apr 20, 2024
I've submitted a PR that seems to fix the initial issue, but I've found another issue. @Table({
indexes: [
{
unique: true,
fields: ["name", "email"],
name: "example_composite_unique_index"
}
]
})
export class Admin extends Model {
/**
* User full name.
*/
@Unique("unique_admin_name")
@Column(DataType.STRING(256))
declare public name: string;
/**
* User email address.
*/
@AllowNull(false)
@Index("admin_email")
declare public email: string;
} This results in the following [
{ name: 'admin_email', fields: [ [Object] ], type: '', parser: null }
] |
Wow, this is actually not closed, I've fixed it internally and just linked this issue internally for us to know about it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
sequelize-typescript overrides the declarated model option indexes with the decorated indexes.
This is due to a misbehaviour in
sequelize-typescript/src/sequelize/sequelize/sequelize.ts
Line 98 in 8ded61a
Versions
Issue type
Related code
The text was updated successfully, but these errors were encountered: