Closed ezkemboi closed 4 years ago
It also needs to make a modification to allow more than one export. In an app, it can have many tables.
Since this is creating tables, we can run the function rather than exporting it. e.g
import { User } from '../models'
async function createTables() {
// create a user table
await User.sync().then(() => {
console.log('Successfully created User table')
}).catch(error => {
console.log('The error: ', error)
})
// exit the process
process.exit(0)
}
// run the function to create tables
createTables()
The command to create tables is npm run create:db
.
Also, with such naming, naming change is required to be create-tables.js
instead of createdb.js
.
Describe the bug Improve the following inside
src/scripts/createdb.js
To Reproduce
Expected behavior
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information): -N/A
Additional context N/A