-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get the database connection working
- Loading branch information
Michael.Taylor
committed
Dec 7, 2021
1 parent
468aa35
commit 1750631
Showing
5 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
config: path.resolve('src', 'config', 'database.json'), | ||
'migrations-path': path.resolve('migrations'), | ||
'models-path': path.resolve('src', 'models'), | ||
'seeders-path': path.resolve('seeders'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"development": { | ||
"dialect": "sqlite", | ||
"storage": "./data.sqlite3" | ||
}, | ||
"test": { | ||
"username": "root", | ||
"password": null, | ||
"database": "database_test", | ||
"host": "127.0.0.1", | ||
"dialect": "mysql" | ||
}, | ||
"production": { | ||
"username": "root", | ||
"password": null, | ||
"database": "database_production", | ||
"host": "127.0.0.1", | ||
"dialect": "mysql" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
import { Sequelize } from 'sequelize'; | ||
export const sequelize = new Sequelize('sqlite::memory:'); | ||
import { fileURLToPath } from 'url'; | ||
import { dirname, resolve } from 'path'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
export const sequelize = new Sequelize({ | ||
dialect: 'sqlite', | ||
storage: resolve(`${__dirname}../../../data.sqlite3`), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters