feat: change require syntax to import
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
require('dotenv').config({ path: './.env' });
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config({ path: './.env' });
|
||||
|
||||
// Validate required environment variables
|
||||
const requiredEnvVars = ['DB_USER', 'DB_PASSWORD', 'DB_NAME', 'DB_HOST', 'DB_PORT'];
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const db = require('./models');
|
||||
import { execSync } from 'child_process';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import db from './models/index.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
async function runMigrations() {
|
||||
try {
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
const process = require('process');
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import Sequelize from 'sequelize';
|
||||
import databaseConfig from '../config/database.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const basename = path.basename(__filename);
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const config = require('../config/database.js')[env];
|
||||
const config = databaseConfig[env];
|
||||
const db = {};
|
||||
|
||||
let sequelize;
|
||||
|
||||
Reference in New Issue
Block a user