This commit is contained in:
29
sync-story.js
Normal file
29
sync-story.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Sync only the Story model to database
|
||||
*/
|
||||
const { sequelize } = require('./config/database');
|
||||
const Story = require('./models/Story');
|
||||
|
||||
async function syncStory() {
|
||||
try {
|
||||
console.log('🔄 Syncing Story (stories) table...');
|
||||
await sequelize.authenticate();
|
||||
console.log('✅ Database connection OK');
|
||||
|
||||
await Story.sync({ alter: true });
|
||||
console.log('✅ Story table synced successfully');
|
||||
|
||||
const [columns] = await sequelize.query('SHOW COLUMNS FROM stories');
|
||||
console.log('\n📋 Columns in stories table:');
|
||||
columns.forEach(col => {
|
||||
console.log(` - ${col.Field} (${col.Type}) default: ${col.Default}`);
|
||||
});
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Error syncing Story:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
syncStory();
|
||||
Reference in New Issue
Block a user