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