mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-11 12:21:37 +02:00
Setup and migrate to Prisma (#456)
This commit is contained in:
parent
129d121364
commit
51d378e4cb
30 changed files with 605 additions and 273 deletions
5
src/utils/create-database-url.ts
Normal file
5
src/utils/create-database-url.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export const createDatabasePath = (directory: string) => `${directory}/db.sqlite`;
|
||||
|
||||
const createDatabaseUrl = (directory: string) => `file:${createDatabasePath(directory)}`;
|
||||
|
||||
export default createDatabaseUrl;
|
|
@ -1,12 +1,3 @@
|
|||
import {Sequelize} from 'sequelize-typescript';
|
||||
import path from 'path';
|
||||
import {DATA_DIR} from '../services/config.js';
|
||||
import {FileCache, KeyValueCache, Settings, Shortcut} from '../models/index.js';
|
||||
import Prisma from '@prisma/client';
|
||||
|
||||
export const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
database: 'muse',
|
||||
storage: path.join(DATA_DIR, 'db.sqlite'),
|
||||
models: [FileCache, KeyValueCache, Settings, Shortcut],
|
||||
logging: false,
|
||||
});
|
||||
export const prisma = new Prisma.PrismaClient();
|
||||
|
|
16
src/utils/log-banner.ts
Normal file
16
src/utils/log-banner.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {makeLines} from 'nodesplash';
|
||||
import metadata from '../../package.json';
|
||||
|
||||
const logBanner = () => {
|
||||
console.log(makeLines({
|
||||
user: 'codetheweb',
|
||||
repository: 'muse',
|
||||
version: metadata.version,
|
||||
paypalUser: 'codetheweb',
|
||||
githubSponsor: 'codetheweb',
|
||||
madeByPrefix: 'Made with 🎶 by ',
|
||||
}).join('\n'));
|
||||
console.log('\n');
|
||||
};
|
||||
|
||||
export default logBanner;
|
Loading…
Add table
Add a link
Reference in a new issue