salix/services/db/import-fixtures.js

20 lines
501 B
JavaScript

const mysql = require('mysql2/promise');
const fs = require('fs-extra');
(async () => {
try {
const connection = await mysql.createConnection({
host: 'localhost',
user: 'root',
multipleStatements: true
});
sql = await fs.readFile(`04-fixtures.sql`, 'utf8');
await connection.query(sql);
await connection.end();
process.exit();
} catch (err) {
console.error(err);
process.exit(1);
}
})();