salix/services/db/import-fixtures.js

20 lines
511 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(`install/dump/fixtures.sql`, 'utf8');
await connection.query(sql);
await connection.end();
process.exit();
} catch (err) {
console.error(err);
process.exit(1);
}
})();