diff --git a/apps/swap/package.json b/apps/swap/package.json deleted file mode 100644 index 16bd4a6..0000000 --- a/apps/swap/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "@bitsacco/swap", - "version": "1.0.0", - "description": "", - "main": "main.js", - "author": "", - "private": true, - "license": "MIT", - "scripts": { - "prisma:gen": "bun run prisma generate", - "migrate:dev": "dotenv -e .env.local -- bun prisma migrate dev", - "migrate:reset": "dotenv -e .env.local -- bun prisma migrate reset" - }, - "devDependencies": { - "dotenv-cli": "^7.4.2" - } -} diff --git a/bun.lockb b/bun.lockb index d640826..53e0ff5 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/docs/contributing.md b/docs/contributing.md index a7a600f..4dd8ee4 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -72,15 +72,3 @@ $ bun proto:gen ``` Resulting typescript files are generated in the `/libs/common/src/types/proto` folder. You might need to manually update the index file in the types folder to include the new files. - -## Working with Prisma - -We use [Prisma](https://prisma.io/) as the ORM for our database. -Each service that uses prisma has a `prisma.schema` file in its corresponding `/src//prisma` folder. -At present, we manually need to gnerate and commit the prisma client whenever the schema is changed. -To do this, run the following command from within the service directory: - -```bash -# generate prisma client -$ bun prisma:gen -``` diff --git a/package.json b/package.json index 5ef65ea..d0cabcc 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,7 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "bun test apps/api/test/ --config ./apps/api/test/jest-e2e.json", "proto:gen": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./libs/common/src/types/proto --ts_proto_opt=nestJs=true -I ./proto ./proto/*.proto", - "proto:clean": "rm ./libs/common/src/types/proto/*.ts", - "migrate": "bun ./scripts/migrate.ts" + "proto:clean": "rm ./libs/common/src/types/proto/*.ts" }, "dependencies": { "@grpc/grpc-js": "^1.12.2", @@ -39,7 +38,6 @@ "@nestjs/platform-express": "^10.0.0", "@nestjs/sequelize": "^10.0.1", "@nestjs/swagger": "^7.4.2", - "@prisma/client": "^5.21.1", "cache-manager": "4.1.0", "cache-manager-redis-store": "^3.0.1", "class-transformer": "^0.5.1", @@ -52,7 +50,6 @@ "nestjs-pino": "^4.1.0", "pino-http": "^10.3.0", "pino-pretty": "^11.3.0", - "prisma": "^5.21.1", "redis": "^4.7.0", "reflect-metadata": "^0.2.0", "rxjs": "^7.8.1", diff --git a/scripts/migrate.ts b/scripts/migrate.ts deleted file mode 100644 index d395914..0000000 --- a/scripts/migrate.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This script runs migrations for all packages that have a `migrate` script in their `package.json`. - * As a prerequisite, the script installs the dependencies of each package. - */ -import { execSync } from 'child_process'; -import fs from 'fs'; -import path from 'path'; - -function findPackagesWithMigrations(dir: string): string[] { - const packages: string[] = []; - const items = fs.readdirSync(dir); - - for (const item of items) { - const fullPath = path.join(dir, item); - if (fs.statSync(fullPath).isDirectory()) { - const packageJsonPath = path.join(fullPath, 'package.json'); - if (fs.existsSync(packageJsonPath)) { - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); - if (packageJson.scripts && packageJson.scripts["migrate:dev"]) { - packages.push(fullPath); - } - } - // Recursively search in subdirectories - packages.push(...findPackagesWithMigrations(fullPath)); - } - } - - return packages; -} - -function runMigrations(): void { - const packagesWithMigrations = findPackagesWithMigrations('.'); - - for (const packagePath of packagesWithMigrations) { - try { - execSync('bun install', { cwd: packagePath, stdio: 'inherit' }); - execSync('bun run migrate:dev', { cwd: packagePath, stdio: 'inherit' }); - } catch (error) { - console.error(`Error running migrations for ${packagePath}:`, error); - } - } -} - -runMigrations();