Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
fix(sequelize): prevent indexes duplication (#375)
Browse files Browse the repository at this point in the history
When running sequelize sync, the unique indexes are created with a different name
on each start. The fix is just to specify a name to prevent duplication.
  • Loading branch information
na-ji authored Jan 23, 2022
1 parent 1923ebf commit c6642b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/sequelize/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const User = {
primaryKey: true,
},
name: { type: DataTypes.STRING },
email: { type: DataTypes.STRING, unique: true },
email: { type: DataTypes.STRING, unique: 'email' },
emailVerified: { type: DataTypes.DATE },
image: { type: DataTypes.STRING },
}
Expand All @@ -38,7 +38,7 @@ export const Session = {
primaryKey: true,
},
expires: { type: DataTypes.DATE, allowNull: false },
sessionToken: { type: DataTypes.STRING, unique: true, allowNull: false },
sessionToken: { type: DataTypes.STRING, unique: 'sessionToken', allowNull: false },
userId: { type: DataTypes.UUID },
}

Expand Down

0 comments on commit c6642b5

Please sign in to comment.