Skip to content
Permalink
e922425bd5
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
21 lines (17 sloc) 447 Bytes
'use strict'
require('dotenv').config()
const fs = require('fs-extra')
const Database = require('sqlite-async')
const createArray = async() => {
const sqlFile = fs.readFileSync(`${__dirname}/seeder.sql`, 'utf-8')
const array = sqlFile.split('\n')
return array
}
const run = async() => {
const db = await Database.open(process.env.DB_NAME)
const sqlArray = await createArray()
for (const sql of sqlArray) {
await db.run(sql)
}
}
run()