mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-09 13:36:57 +00:00
fixed usage of migrations
Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
94c3857d49
commit
6480c142a9
3 changed files with 31 additions and 10 deletions
|
@ -1,8 +1,31 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const envs = ['development', 'test', 'production'];
|
||||
|
||||
if (!fs.existsSync(path.resolve('config'))) {
|
||||
fs.mkdirSync(path.resolve('config'));
|
||||
}
|
||||
|
||||
const configJson = JSON.parse(fs.readFileSync('config.json'));
|
||||
|
||||
let database = {};
|
||||
envs.forEach(function (env, i) {
|
||||
if (configJson[env]) {
|
||||
database[env] = {
|
||||
...configJson[env].db
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFile(path.resolve('config', 'database.json'), JSON.stringify(database), 'utf8', function (err) {
|
||||
if (err) {
|
||||
console.log("An error occured while writing JSON Object to File.");
|
||||
return console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
'config': path.resolve('config.json'),
|
||||
'config': path.resolve('config', 'database.json'),
|
||||
'migrations-path': path.resolve('lib', 'migrations'),
|
||||
'models-path': path.resolve('lib', 'models'),
|
||||
'url': 'change this'
|
||||
}
|
||||
'models-path': path.resolve('lib', 'models')
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
'use strict'
|
||||
const isSQLite = require('../utils').isSQLite
|
||||
function isSQLite (sequelize) {
|
||||
return sequelize.options.dialect === 'sqlite'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
up: function (queryInterface, Sequelize) {
|
||||
return queryInterface.changeColumn('Notes', 'title', {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
import { Sequelize } from 'sequelize-typescript'
|
||||
import { logger } from './logger'
|
||||
import { realtime } from './realtime'
|
||||
import { config } from './config'
|
||||
import fs from 'fs'
|
||||
import { Revision } from './models'
|
||||
|
||||
export function isSQLite (sequelize: Sequelize): boolean {
|
||||
return sequelize.options.dialect === 'sqlite'
|
||||
}
|
||||
|
||||
export function getImageMimeType (imagePath: string): string | undefined {
|
||||
const fileExtension = /[^.]+$/.exec(imagePath)
|
||||
switch (fileExtension?.[0]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue