feat: comment to test run's case (#390)

This commit is contained in:
kimatata
2026-02-23 12:26:07 +09:00
committed by GitHub
parent 1f4ac0ae7b
commit a9674c81ab
27 changed files with 1045 additions and 40 deletions

View File

@@ -0,0 +1,47 @@
export async function up(queryInterface, Sequelize) {
await queryInterface.createTable('comments', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
commentableType: {
type: Sequelize.STRING,
allowNull: false,
},
commentableId: {
type: Sequelize.INTEGER,
allowNull: false,
},
userId: {
type: Sequelize.INTEGER,
references: {
model: 'users',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
content: {
type: Sequelize.TEXT,
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
// Add composite index for efficient polymorphic queries
await queryInterface.addIndex('comments', ['commentableType', 'commentableId'], {
name: 'comments_commentable_index',
});
}
export async function down(queryInterface) {
await queryInterface.dropTable('comments');
}