Skip to content

Commit

Permalink
lets record for a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tushar Dahiya committed Jun 13, 2024
1 parent 5d72659 commit 9b56a13
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 318 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default config;


why do we want to ignoreBuildErrors and ignoreDuringBuilds
we can check types, we can check eslints in the github actions in the github actions and not to block our builds, we want all of our things in one place
we can check types, we can check eslints in the github actions in the github actions and not to block our builds,
we want all of our things in one place

next things is to turn on the infamous turbo pack
next dev --turbo in our package.json file
Expand All @@ -100,9 +101,9 @@ u can use tool like drizzle very specifically for this, this very cool feature i

go to src/server/db/schema.ts

t3 has a prefix in all the tables, which means when u use any database technologies with drizzle in this case postgres, it will
only effect things which start with your project name, like in this case newstuff_, with this we can have multiple different
projects sharing the database seperated tables with this prefix name
t3 has a prefix in all the tables, which means when u use any database technologies with drizzle in this case postgres,
it will only effect things which start with your project name, like in this case newstuff_, with this we can have multiple
different projects sharing the database seperated tables with this prefix name

export const createTable = pgTableCreator((name) => `newstuff_${name}`);

Expand All @@ -111,8 +112,17 @@ db:push : drizzle-kit push:pg

migration sucks
they fail to acknowledge alot of things that r necessary for scaling the database and also for using these things with teams
we have bunch of git diff to show how these things changed in the order we changed them in but migration don't encapsulate that properly
they come from a pre version control era, as such it is recommend to use db:push, their is alot of content of this
we have bunch of git diff to show how these things changed in the order we changed them in but migration don't encapsulate
that properly they come from a pre version control era, as such it is recommend to use db:push, their is alot of content of
this

we r gonna use db:push

we r gonna update the datbase to match our current schema
`pnpm run db:push`

if we see how this looks in database

to see the stuff in our database we can
`pnpm run db:studio`
db:studio will take advantabe of drizzle studio, which is super usefull
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
schema: "./src/server/db/schema.ts",
driver: "pg",
dbCredentials: {
connectionString: env.DATABASE_URL,
connectionString: env.POSTGRES_URL,
},
tablesFilter: ["newstuff_*"],
} satisfies Config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dependencies": {
"@t3-oss/env-nextjs": "^0.10.1",
"@vercel/postgres": "^0.8.0",
"drizzle-orm": "^0.29.4",
"next": "^14.2.1",
"postgres": "^3.4.3",
"react": "18.2.0",
Expand All @@ -28,7 +27,8 @@
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"drizzle-kit": "^0.20.14",
"drizzle-kit": "^0.22.7",
"drizzle-orm": "^0.31.2",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-drizzle": "^0.2.3",
Expand Down
Loading

0 comments on commit 9b56a13

Please sign in to comment.