refactor: relocate db scripts

This commit is contained in:
Bobby Wibowo 2022-06-22 13:53:01 +07:00
parent 9d4c08e460
commit 409d0c4ffd
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
4 changed files with 4 additions and 6 deletions

2
.gitignore vendored
View File

@ -62,8 +62,6 @@ package-lock.json
.node-version .node-version
.nvmrc .nvmrc
!.gitkeep !.gitkeep
/start.json
/migrate.js
# User directories (renders) # User directories (renders)
/public/render/**/original /public/render/**/original

View File

@ -1,4 +1,4 @@
const init = async db => { const initDatabase = async db => {
// Create the tables we need to store galleries and files // Create the tables we need to store galleries and files
await db.schema.hasTable('albums').then(exists => { await db.schema.hasTable('albums').then(exists => {
if (!exists) { if (!exists) {
@ -63,10 +63,10 @@ const init = async db => {
password: hash, password: hash,
token: require('randomstring').generate(64), token: require('randomstring').generate(64),
timestamp, timestamp,
permission: require('./../controllers/permissionController').permissions.superadmin, permission: require('./../permissionController').permissions.superadmin,
registration: timestamp registration: timestamp
}) })
} }
} }
module.exports = init module.exports = initDatabase

View File

@ -21,7 +21,7 @@
"watch": "gulp watch", "watch": "gulp watch",
"develop": "env NODE_ENV=development gulp watch", "develop": "env NODE_ENV=development gulp watch",
"dev": "env NODE_ENV=development gulp watch", "dev": "env NODE_ENV=development gulp watch",
"migrate": "node ./database/migration.js", "migrate": "node ./scripts/migrate.js",
"bump-versions": "node ./scripts/bump-versions.js", "bump-versions": "node ./scripts/bump-versions.js",
"cf-purge": "node ./scripts/cf-purge.js", "cf-purge": "node ./scripts/cf-purge.js",
"clean-up": "node ./scripts/clean-up.js", "clean-up": "node ./scripts/clean-up.js",