FIX TOO MANY KEYS ISSUE PLSS
This commit is contained in:
@@ -24,18 +24,18 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}, {
|
||||
tableName: 'post_tags',
|
||||
timestamps: false,
|
||||
indexes: [
|
||||
{
|
||||
unique: true,
|
||||
fields: ['postId', 'tagId'] // Composite unique index
|
||||
},
|
||||
{
|
||||
fields: ['postId'] // Index for efficient querying
|
||||
},
|
||||
{
|
||||
fields: ['tagId'] // Index for efficient querying
|
||||
}
|
||||
]
|
||||
// indexes: [
|
||||
// {
|
||||
// unique: true,
|
||||
// fields: ['postId', 'tagId'] // Composite unique index
|
||||
// },
|
||||
// {
|
||||
// fields: ['postId'] // Index for efficient querying
|
||||
// },
|
||||
// {
|
||||
// fields: ['tagId'] // Index for efficient querying
|
||||
// }
|
||||
// ]
|
||||
});
|
||||
|
||||
return PostTag;
|
||||
|
||||
@@ -9,11 +9,17 @@ module.exports = (sequelize, DataTypes) => {
|
||||
tag: {
|
||||
type: DataTypes.STRING(30),
|
||||
allowNull: false,
|
||||
unique: true, // Ensure tags are unique
|
||||
},
|
||||
}, {
|
||||
tableName: 'tags',
|
||||
timestamps: false,
|
||||
// indexes: [
|
||||
// {
|
||||
// unique: true,
|
||||
// fields: ['tag'], // Unique index on the tag column
|
||||
// name: 'unique_tag_index', // Explicitly naming the index
|
||||
// }
|
||||
// ]
|
||||
});
|
||||
|
||||
Tag.associate = (models) => {
|
||||
|
||||
Reference in New Issue
Block a user