Skip to content

Commit ed9fa42

Browse files
authored
Migrate database setup to scripts (#284)
1 parent 1246024 commit ed9fa42

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"dev:infra": "docker compose -f ./docker-compose-infra.yml up -d",
1616
"build": "yarn && rm -rf dist && tsc -p ./tsconfig.json --outDir dist",
1717
"generate:sdk": "npx tsx ./src/scripts/generate-sdk",
18-
"prisma:setup:dev": "npx tsx ./src/db/scripts/setup.ts",
19-
"prisma:setup:prod": "npx tsx ./dist/db/scripts/setup.js",
18+
"prisma:setup:dev": "npx tsx ./src/scripts/setup-db.ts",
19+
"prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js",
2020
"start": "yarn prisma:setup:prod && (yarn start:server & yarn start:worker)",
2121
"start:server": "node --experimental-specifier-resolution=node ./dist/server/index.js",
2222
"start:worker": "node --experimental-specifier-resolution=node ./dist/worker/index.js",

src/db/scripts/setup.ts renamed to src/scripts/setup-db.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { execSync } from "child_process";
2-
import { prisma } from "../client";
2+
import { prisma } from "../db/client";
33

44
const main = async () => {
55
const [{ exists: hasWalletsTable }]: [{ exists: boolean }] =
66
await prisma.$queryRaw`
7-
SELECT EXISTS (
8-
SELECT 1
9-
FROM pg_tables
10-
WHERE schemaname = 'public'
11-
AND tablename = 'wallets'
12-
);
13-
`;
7+
SELECT EXISTS (
8+
SELECT 1
9+
FROM pg_tables
10+
WHERE schemaname = 'public'
11+
AND tablename = 'wallets'
12+
);
13+
`;
1414

1515
const schema =
1616
process.env.NODE_ENV === "production"

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"src/**/*.js",
2626
"src/**/*.d.ts"
2727
],
28-
"exclude": ["node_modules", "src/scripts"]
28+
"exclude": ["node_modules"]
2929
}

0 commit comments

Comments
 (0)