Skip to content

Commit ee157ae

Browse files
Update DB seeder & refactor it into separate files
1 parent 3b3b878 commit ee157ae

6 files changed

Lines changed: 267 additions & 183 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"test": "dotenv -e .env.test -o -- vitest",
4040
"db:reset": "prisma migrate reset --skip-seed",
4141
"dev": "tsx watch --env-file-if-exists=.env ./src/server.ts",
42-
"db:seed": "tsx --env-file-if-exists=.env ./prisma/seed/run.ts",
42+
"db:seed": "tsx --env-file-if-exists=.env ./prisma/seed/script.ts",
4343
"build": "tsc --pretty -p tsconfig.prod.json && tsc-alias -p tsconfig.prod.json",
4444
"test:db:push": "dotenv -e .env.test -o -- prisma db push --skip-generate --force-reset",
4545
"pg:down": "docker compose -f docker-compose.postgres.yml down --remove-orphans",

prisma/seed/data.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
export const postTitles = [
2+
'How I Built a Portfolio While Learning to Code',
3+
'Docker Compose for Local Development',
4+
'Understanding JWT: Auth Made Simple',
5+
'Top 5 VS Code Extensions for JavaScript Developers',
6+
"REST vs. GraphQL: A Developer's Perspective",
7+
'Mastering Zod for Schema Validation',
8+
'How to Secure Your Express App',
9+
'Deploying Node.js Apps with Koyeb',
10+
'CSS-in-JS: Should You Use It in 2025?',
11+
'Why TypeScript Is Worth the Learning Curve',
12+
];
13+
14+
export const tags = [
15+
'open_source',
16+
'full_stack',
17+
'javascript',
18+
'typescript',
19+
'security',
20+
'frontend',
21+
'software',
22+
'testing',
23+
'backend',
24+
];
25+
26+
export const usersData = [
27+
{
28+
username: 'nowhere-man',
29+
fullname: 'Nowhere-Man',
30+
bio: 'From Nowhere land with love.',
31+
},
32+
{
33+
username: 'superman',
34+
fullname: 'Clark Kent / Kal-El',
35+
bio: 'From Krypton with love.',
36+
},
37+
{
38+
username: 'batman',
39+
fullname: 'Bruce Wayne',
40+
bio: 'From Gotham with love.',
41+
},
42+
];
43+
44+
export const IMAGE_BASE_URL =
45+
'https://ndauvqaezozccgtddhkr.supabase.co/storage/v1/object/public';

prisma/seed/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './run';
2-
export * from './run';
1+
export { default } from './script';
2+
export * from './script';

prisma/seed/run.ts

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)