chore: remove everything prisma related
This commit is contained in:
parent
4f8519b271
commit
f22e49f920
15 changed files with 31 additions and 226 deletions
|
@ -16,7 +16,6 @@ COPY ./pnpm-lock.yaml ./
|
|||
RUN pnpm fetch --no-scripts
|
||||
|
||||
COPY ./package*.json ./
|
||||
COPY ./prisma/schema.prisma ./prisma/
|
||||
|
||||
RUN pnpm install -r --prefer-offline
|
||||
COPY ./src ./src
|
||||
|
|
|
@ -11,7 +11,6 @@ COPY ./pnpm-lock.yaml ./
|
|||
RUN pnpm fetch --ignore-scripts
|
||||
|
||||
COPY ./package*.json ./
|
||||
COPY ./prisma/schema.prisma ./prisma/
|
||||
|
||||
RUN pnpm install -r --prefer-offline
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"test": "dotenv -e .env.test -- jest --colors",
|
||||
"test:client": "jest --colors --selectProjects client --",
|
||||
"test:server": "jest --colors --selectProjects server --",
|
||||
"postinstall": "prisma generate",
|
||||
"dev": "npm run copy:migrations && nodemon",
|
||||
"start": "NODE_ENV=production node index.js",
|
||||
"lint": "next lint",
|
||||
|
@ -32,7 +31,6 @@
|
|||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1",
|
||||
"@prisma/client": "^4.12.0",
|
||||
"@radix-ui/react-dialog": "^1.0.3",
|
||||
"@radix-ui/react-select": "^1.2.1",
|
||||
"@radix-ui/react-switch": "^1.0.2",
|
||||
|
@ -48,7 +46,7 @@
|
|||
"@trpc/server": "^10.16.0",
|
||||
"argon2": "^0.30.3",
|
||||
"clsx": "^1.1.1",
|
||||
"drizzle-orm": "^0.23.11",
|
||||
"drizzle-orm": "^0.24.1",
|
||||
"express": "^4.17.3",
|
||||
"fs-extra": "^11.1.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
|
@ -127,7 +125,6 @@
|
|||
"next-router-mock": "^0.9.2",
|
||||
"nodemon": "^2.0.21",
|
||||
"prettier": "^2.8.4",
|
||||
"prisma": "^4.12.0",
|
||||
"ts-jest": "^29.0.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.0.2",
|
||||
|
|
|
@ -13,9 +13,6 @@ dependencies:
|
|||
'@otplib/plugin-thirty-two':
|
||||
specifier: ^12.0.1
|
||||
version: 12.0.1
|
||||
'@prisma/client':
|
||||
specifier: ^4.12.0
|
||||
version: 4.12.0(prisma@4.12.0)
|
||||
'@radix-ui/react-dialog':
|
||||
specifier: ^1.0.3
|
||||
version: 1.0.3(@types/react@18.0.28)(react-dom@18.2.0)(react@18.2.0)
|
||||
|
@ -62,8 +59,8 @@ dependencies:
|
|||
specifier: ^1.1.1
|
||||
version: 1.2.1
|
||||
drizzle-orm:
|
||||
specifier: ^0.23.11
|
||||
version: 0.23.11(@types/pg@8.6.6)(pg@8.10.0)
|
||||
specifier: ^0.24.1
|
||||
version: 0.24.1(@types/pg@8.6.6)(pg@8.10.0)
|
||||
express:
|
||||
specifier: ^4.17.3
|
||||
version: 4.18.2
|
||||
|
@ -294,9 +291,6 @@ devDependencies:
|
|||
prettier:
|
||||
specifier: ^2.8.4
|
||||
version: 2.8.4
|
||||
prisma:
|
||||
specifier: ^4.12.0
|
||||
version: 4.12.0
|
||||
ts-jest:
|
||||
specifier: ^29.0.3
|
||||
version: 29.0.5(@babel/core@7.21.3)(esbuild@0.16.17)(jest@29.5.0)(typescript@5.0.2)
|
||||
|
@ -1595,28 +1589,6 @@ packages:
|
|||
resolution: {integrity: sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==}
|
||||
dev: false
|
||||
|
||||
/@prisma/client@4.12.0(prisma@4.12.0):
|
||||
resolution: {integrity: sha512-j9/ighfWwux97J2dS15nqhl60tYoH8V0IuSsgZDb6bCFcQD3fXbXmxjYC8GHhIgOk3lB7Pq+8CwElz2MiDpsSg==}
|
||||
engines: {node: '>=14.17'}
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
prisma: '*'
|
||||
peerDependenciesMeta:
|
||||
prisma:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@prisma/engines-version': 4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7
|
||||
prisma: 4.12.0
|
||||
dev: false
|
||||
|
||||
/@prisma/engines-version@4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7:
|
||||
resolution: {integrity: sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==}
|
||||
dev: false
|
||||
|
||||
/@prisma/engines@4.12.0:
|
||||
resolution: {integrity: sha512-0alKtnxhNB5hYU+ymESBlGI4b9XrGGSdv7Ud+8TE/fBNOEhIud0XQsAR+TrvUZgS4na5czubiMsODw0TUrgkIA==}
|
||||
requiresBuild: true
|
||||
|
||||
/@radix-ui/number@1.0.0:
|
||||
resolution: {integrity: sha512-Ofwh/1HX69ZfJRiRBMTy7rgjAzHmwe4kW9C9Y99HTRUcYLUuVT0KESFj15rPjRgKJs20GPq8Bm5aEDJ8DuA3vA==}
|
||||
dependencies:
|
||||
|
@ -3932,8 +3904,8 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/drizzle-orm@0.23.11(@types/pg@8.6.6)(pg@8.10.0):
|
||||
resolution: {integrity: sha512-uqebUff9QeDo0ZI+s5XurmHjFNDuQMbnNObWIClzotU+iI0RfA1RSEXbK3lSp1FNp/HeUy23yIv8lkYzU9278A==}
|
||||
/drizzle-orm@0.24.1(@types/pg@8.6.6)(pg@8.10.0):
|
||||
resolution: {integrity: sha512-N6XRbwj55hOa1G/b07/jG3axD1NufyJPm4UxJapJx6u0BLFEfAzkrtW3V27rrtsYUHHO8rbOgvvMwXP16NvBng==}
|
||||
peerDependencies:
|
||||
'@aws-sdk/client-rds-data': '>=3'
|
||||
'@cloudflare/workers-types': '>=3'
|
||||
|
@ -7834,14 +7806,6 @@ packages:
|
|||
react-is: 18.2.0
|
||||
dev: true
|
||||
|
||||
/prisma@4.12.0:
|
||||
resolution: {integrity: sha512-xqVper4mbwl32BWzLpdznHAYvYDWQQWK2tBfXjdUD397XaveRyAP7SkBZ6kFlIg8kKayF4hvuaVtYwXd9BodAg==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@prisma/engines': 4.12.0
|
||||
|
||||
/prompts@2.4.2:
|
||||
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
|
||||
engines: {node: '>= 6'}
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model App {
|
||||
id String @id(map: "PK_9478629fc093d229df09e560aea") @unique(map: "UQ_9478629fc093d229df09e560aea") @db.VarChar
|
||||
status app_status_enum @default(stopped)
|
||||
lastOpened DateTime? @default(now()) @db.Timestamptz(6)
|
||||
numOpened Int @default(0)
|
||||
config Json
|
||||
createdAt DateTime @default(now()) @db.Timestamp(6)
|
||||
updatedAt DateTime @default(now()) @db.Timestamp(6)
|
||||
version Int @default(1)
|
||||
exposed Boolean @default(false)
|
||||
domain String? @db.VarChar
|
||||
|
||||
@@map("app")
|
||||
}
|
||||
|
||||
model Migrations {
|
||||
id Int @id
|
||||
name String @unique @db.VarChar(100)
|
||||
hash String @db.VarChar(40)
|
||||
executed_at DateTime? @default(now()) @db.Timestamp(6)
|
||||
|
||||
@@map("migrations")
|
||||
}
|
||||
|
||||
model Update {
|
||||
id Int @id(map: "PK_575f77a0576d6293bc1cb752847") @default(autoincrement())
|
||||
name String @unique(map: "UQ_6e7d7ecccdc972caa0ad33cb014") @db.VarChar
|
||||
status update_status_enum
|
||||
createdAt DateTime @default(now()) @db.Timestamp(6)
|
||||
updatedAt DateTime @default(now()) @db.Timestamp(6)
|
||||
|
||||
@@map("update")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id(map: "PK_cace4a159ff9f2512dd42373760") @default(autoincrement())
|
||||
username String @unique(map: "UQ_78a916df40e02a9deb1c4b75edb") @db.VarChar
|
||||
password String @db.VarChar
|
||||
createdAt DateTime @default(now()) @db.Timestamp(6)
|
||||
updatedAt DateTime @default(now()) @db.Timestamp(6)
|
||||
operator Boolean @default(false)
|
||||
totp_secret String?
|
||||
totp_enabled Boolean @default(false)
|
||||
salt String?
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
|
||||
enum app_status_enum {
|
||||
running
|
||||
stopped
|
||||
installing
|
||||
uninstalling
|
||||
stopping
|
||||
starting
|
||||
missing
|
||||
updating
|
||||
}
|
||||
|
||||
enum update_status_enum {
|
||||
FAILED
|
||||
SUCCESS
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
import { Tooltip } from 'react-tooltip';
|
||||
import * as AppTypes from '../../core/types';
|
||||
import { type AppStatus as AppStatusEnum } from '@/server/db/schema';
|
||||
import styles from './AppStatus.module.scss';
|
||||
|
||||
export const AppStatus: React.FC<{ status: AppTypes.AppStatus; lite?: boolean }> = ({ status, lite }) => {
|
||||
export const AppStatus: React.FC<{ status: AppStatusEnum; lite?: boolean }> = ({ status, lite }) => {
|
||||
const formattedStatus = `${status[0]?.toUpperCase()}${status.substring(1, status.length).toLowerCase()}`;
|
||||
|
||||
const classes = clsx('status-dot status-gray', {
|
||||
|
|
|
@ -2,11 +2,12 @@ import Link from 'next/link';
|
|||
import React from 'react';
|
||||
import { IconDownload } from '@tabler/icons-react';
|
||||
import { Tooltip } from 'react-tooltip';
|
||||
import { AppStatus as AppStatusEnum } from '@/server/db/schema';
|
||||
import { AppStatus } from '../AppStatus';
|
||||
import { AppLogo } from '../AppLogo/AppLogo';
|
||||
import { limitText } from '../../modules/AppStore/helpers/table.helpers';
|
||||
import styles from './AppTile.module.scss';
|
||||
import { AppInfo, AppStatus as AppStatusEnum } from '../../core/types';
|
||||
import { AppInfo } from '../../core/types';
|
||||
|
||||
type AppTileInfo = Pick<AppInfo, 'id' | 'name' | 'description' | 'short_desc'>;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as Router from '../../server/routers/_app';
|
||||
|
||||
export type RouterOutput = Router.RouterOutput;
|
||||
export type { FormField, AppInfo } from '../../server/services/apps/apps.helpers';
|
||||
export type { AppStatus, AppCategory } from '../../server/services/apps/apps.types';
|
||||
export type { FormField, AppInfo } from '@/server/services/apps/apps.helpers';
|
||||
export type { AppCategory } from '@/server/services/apps/apps.types';
|
||||
|
||||
export type App = Omit<Router.RouterOutput['app']['getApp'], 'info'>;
|
||||
export type AppWithInfo = Router.RouterOutput['app']['getApp'];
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { faker } from '@faker-js/faker';
|
||||
import { AppStatus, APP_CATEGORIES } from '../../../server/services/apps/apps.types';
|
||||
import { AppStatus } from '@/server/db/schema';
|
||||
import { APP_CATEGORIES } from '../../../server/services/apps/apps.types';
|
||||
import { App, AppCategory, AppInfo, AppWithInfo } from '../../core/types';
|
||||
|
||||
const randomCategory = (): AppCategory[] => {
|
||||
|
@ -51,10 +52,10 @@ export const createAppEntity = (params: CreateAppEntityParams): AppWithInfo => {
|
|||
exposed: false,
|
||||
domain: null,
|
||||
version: 1,
|
||||
lastOpened: faker.date.past(),
|
||||
lastOpened: faker.date.past().toISOString(),
|
||||
numOpened: 0,
|
||||
createdAt: faker.date.past(),
|
||||
updatedAt: faker.date.past(),
|
||||
createdAt: faker.date.past().toISOString(),
|
||||
updatedAt: faker.date.past().toISOString(),
|
||||
latestVersion: 1,
|
||||
latestDockerVersion: '1.0.0',
|
||||
...overrides,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Icon, IconDownload, IconExternalLink, IconPlayerPause, IconPlayerPlay, IconSettings, IconTrash, IconX } from '@tabler/icons-react';
|
||||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
import type { AppStatus } from '../../../../../server/services/apps/apps.types';
|
||||
import type { AppStatus } from '@/server/db/schema';
|
||||
|
||||
import { Button } from '../../../../components/ui/Button';
|
||||
import { AppInfo } from '../../../../core/types';
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* eslint-disable vars-on-top */
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
import { getConfig } from '../core/TipiConfig/TipiConfig';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-var
|
||||
var prisma: PrismaClient | undefined;
|
||||
}
|
||||
|
||||
export const prisma =
|
||||
global.prisma ||
|
||||
new PrismaClient({
|
||||
log: getConfig().NODE_ENV === 'development' ? ['query', 'warn', 'error'] : ['error'],
|
||||
datasources: {
|
||||
db: {
|
||||
url: `postgresql://${getConfig().postgresUsername}:${getConfig().postgresPassword}@${getConfig().postgresHost}:${getConfig().postgresPort}/${getConfig().postgresDatabase}?connect_timeout=300`,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (getConfig().NODE_ENV !== 'production') {
|
||||
global.prisma = prisma;
|
||||
}
|
|
@ -1,20 +1,11 @@
|
|||
import { InferModel } from 'drizzle-orm';
|
||||
import { pgTable, pgEnum, integer, varchar, timestamp, serial, boolean, text, jsonb } from 'drizzle-orm/pg-core';
|
||||
|
||||
const APP_STATUS = {
|
||||
updating: 'updating',
|
||||
missing: 'missing',
|
||||
starting: 'starting',
|
||||
stopping: 'stopping',
|
||||
uninstalling: 'uninstalling',
|
||||
installing: 'installing',
|
||||
stopped: 'stopped',
|
||||
running: 'running',
|
||||
} as const;
|
||||
export type AppStatus = (typeof APP_STATUS)[keyof typeof APP_STATUS];
|
||||
|
||||
export const updateStatusEnum = pgEnum('update_status_enum', ['SUCCESS', 'FAILED']);
|
||||
export const appStatusEnum = pgEnum('app_status_enum', Object.values(APP_STATUS) as [string, ...string[]]);
|
||||
export const appStatusEnum = pgEnum('app_status_enum', ['running', 'stopped', 'starting', 'stopping', 'updating', 'missing', 'installing', 'uninstalling']);
|
||||
|
||||
const APP_STATUS = appStatusEnum.enumValues;
|
||||
export type AppStatus = (typeof APP_STATUS)[number];
|
||||
|
||||
export const migrations = pgTable('migrations', {
|
||||
id: integer('id').notNull(),
|
||||
|
|
|
@ -5,7 +5,6 @@ import { AppServiceClass } from './apps.service';
|
|||
import { EventDispatcher, EVENT_TYPES } from '../../core/EventDispatcher';
|
||||
import { AppInfo, getEnvMap } from './apps.helpers';
|
||||
import { createApp, getAllApps, getAppById, updateApp } from '../../tests/apps.factory';
|
||||
import { APP_STATUS } from './apps.types';
|
||||
import { setConfig } from '../../core/TipiConfig';
|
||||
|
||||
let db: TestDatabase;
|
||||
|
@ -52,7 +51,7 @@ describe('Install app', () => {
|
|||
expect(app).toBeDefined();
|
||||
expect(app?.id).toBe(app1.id);
|
||||
expect(app?.config).toStrictEqual({ TEST_FIELD: 'test' });
|
||||
expect(app?.status).toBe(APP_STATUS.RUNNING);
|
||||
expect(app?.status).toBe('running');
|
||||
});
|
||||
|
||||
it('Should start app if already installed', async () => {
|
||||
|
@ -233,7 +232,7 @@ describe('Uninstall app', () => {
|
|||
// Assert
|
||||
expect(app).toBeDefined();
|
||||
expect(app?.id).toBe(app1.id);
|
||||
expect(app?.status).toBe(APP_STATUS.RUNNING);
|
||||
expect(app?.status).toBe('running');
|
||||
});
|
||||
|
||||
it('Should correctly remove app from database', async () => {
|
||||
|
@ -273,7 +272,7 @@ describe('Uninstall app', () => {
|
|||
// Act & Assert
|
||||
await expect(AppsService.uninstallApp(app1.id)).rejects.toThrow(`App ${app1.id} failed to uninstall\nstdout: test`);
|
||||
const app = await getAppById(app1.id, db);
|
||||
expect(app?.status).toBe(APP_STATUS.STOPPED);
|
||||
expect(app?.status).toBe('stopped');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -329,7 +328,7 @@ describe('Start app', () => {
|
|||
// Act & Assert
|
||||
await expect(AppsService.startApp(app1.id)).rejects.toThrow(`App ${app1.id} failed to start\nstdout: test`);
|
||||
const app = await getAppById(app1.id, db);
|
||||
expect(app?.status).toBe(APP_STATUS.STOPPED);
|
||||
expect(app?.status).toBe('stopped');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -362,7 +361,7 @@ describe('Stop app', () => {
|
|||
// Act & Assert
|
||||
await expect(AppsService.stopApp(app1.id)).rejects.toThrow(`App ${app1.id} failed to stop\nstdout: test`);
|
||||
const app = await getAppById(app1.id, db);
|
||||
expect(app?.status).toBe(APP_STATUS.RUNNING);
|
||||
expect(app?.status).toBe('running');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -472,7 +471,7 @@ describe('Get app config', () => {
|
|||
expect(app).toBeDefined();
|
||||
expect(app.config).toStrictEqual({ TEST_FIELD: 'test' });
|
||||
expect(app.id).toBe(app1.id);
|
||||
expect(app.status).toBe(APP_STATUS.RUNNING);
|
||||
expect(app.status).toBe('running');
|
||||
});
|
||||
|
||||
it('Should return default values if app is not installed', async () => {
|
||||
|
@ -484,7 +483,7 @@ describe('Get app config', () => {
|
|||
expect(appconfig).toBeDefined();
|
||||
expect(appconfig.id).toBe(appInfo.id);
|
||||
expect(appconfig.config).toStrictEqual({});
|
||||
expect(appconfig.status).toBe(APP_STATUS.MISSING);
|
||||
expect(appconfig.status).toBe('missing');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -590,7 +589,7 @@ describe('Update app', () => {
|
|||
expect(app).toBeDefined();
|
||||
expect(app?.config).toStrictEqual({ TEST_FIELD: 'test' });
|
||||
expect(app?.version).toBe(app1.tipi_version);
|
||||
expect(app?.status).toBe(APP_STATUS.STOPPED);
|
||||
expect(app?.status).toBe('stopped');
|
||||
});
|
||||
|
||||
it("Should throw if app doesn't exist", async () => {
|
||||
|
@ -607,7 +606,7 @@ describe('Update app', () => {
|
|||
|
||||
await expect(AppsService.updateApp(app1.id)).rejects.toThrow(`App ${app1.id} failed to update\nstdout: error`);
|
||||
const app = await getAppById(app1.id, db);
|
||||
expect(app?.status).toBe(APP_STATUS.STOPPED);
|
||||
expect(app?.status).toBe('stopped');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -676,7 +675,7 @@ describe('startAllApps', () => {
|
|||
// Assert
|
||||
await waitForExpect(async () => {
|
||||
const apps = await getAllApps(db);
|
||||
expect(apps[0]?.status).toBe(APP_STATUS.STOPPED);
|
||||
expect(apps[0]?.status).toBe('stopped');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,16 +1,3 @@
|
|||
export const APP_STATUS = {
|
||||
INSTALLING: 'installing',
|
||||
MISSING: 'missing',
|
||||
RUNNING: 'running',
|
||||
STARTING: 'starting',
|
||||
STOPPED: 'stopped',
|
||||
STOPPING: 'stopping',
|
||||
UNINSTALLING: 'uninstalling',
|
||||
UPDATING: 'updating',
|
||||
} as const;
|
||||
|
||||
export type AppStatus = (typeof APP_STATUS)[keyof typeof APP_STATUS];
|
||||
|
||||
export const APP_CATEGORIES = {
|
||||
NETWORK: 'network',
|
||||
MEDIA: 'media',
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
import { PrismaClient } from '@prisma/client';
|
||||
import pg from 'pg';
|
||||
import { runPostgresMigrations } from '../../src/server/run-migration';
|
||||
import { getConfig } from '../../src/server/core/TipiConfig';
|
||||
|
||||
/**
|
||||
* Given a test suite name, create a new database and return a client to it.
|
||||
*
|
||||
* @param {string} testsuite - name of the test suite
|
||||
*/
|
||||
async function getTestDbClient(testsuite: string) {
|
||||
const pgClient = new pg.Client({
|
||||
user: getConfig().postgresUsername,
|
||||
host: getConfig().postgresHost,
|
||||
database: getConfig().postgresDatabase,
|
||||
password: getConfig().postgresPassword,
|
||||
port: getConfig().postgresPort,
|
||||
});
|
||||
await pgClient.connect();
|
||||
|
||||
await pgClient.query(`DROP DATABASE IF EXISTS ${testsuite}`);
|
||||
await pgClient.query(`CREATE DATABASE ${testsuite}`);
|
||||
|
||||
await pgClient.end();
|
||||
|
||||
await runPostgresMigrations(testsuite);
|
||||
|
||||
return new PrismaClient({
|
||||
datasources: {
|
||||
db: {
|
||||
url: `postgresql://${getConfig().postgresUsername}:${getConfig().postgresPassword}@${getConfig().postgresHost}:${getConfig().postgresPort}/${testsuite}?connect_timeout=300`,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export { getTestDbClient };
|
Loading…
Reference in a new issue