spurrin-backend/src/migrations/template.js
2025-06-09 11:11:52 +05:30

37 lines
828 B
JavaScript

const db = require('../config/database');
/**
* Migration template
*
* To create a new migration:
* 1. Copy this file
* 2. Rename it with timestamp and description (e.g., 20240315000000_create_hospitals_table.js)
* 3. Implement up() and down() methods
* 4. Add your SQL queries
*/
module.exports = {
/**
* Run the migration
*/
async up() {
// Add your migration SQL here
// Example:
// await db.query(`
// CREATE TABLE IF NOT EXISTS table_name (
// id INT AUTO_INCREMENT PRIMARY KEY,
// name VARCHAR(255) NOT NULL,
// created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
// )
// `);
},
/**
* Rollback the migration
*/
async down() {
// Add your rollback SQL here
// Example:
// await db.query('DROP TABLE IF EXISTS table_name');
}
};