mirror of
https://github.com/opus-tango/socialdb-sh.git
synced 2026-03-20 03:55:27 +00:00
set up drizzle
This commit is contained in:
@@ -46,6 +46,12 @@ I'm not sure about auth yet, but probably NextAuth.
|
|||||||
The project is meant to be self hosted, with a single docker compose file to deploy the application and the database.
|
The project is meant to be self hosted, with a single docker compose file to deploy the application and the database.
|
||||||
It's still in the early stages of development, so it's not yet ready for production.
|
It's still in the early stages of development, so it's not yet ready for production.
|
||||||
|
|
||||||
|
I can't get file watching to work with the docker compose file, so I'm running the dev server natively, with postgres in a container.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
|
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
|
||||||
|
|
||||||
|
### db command
|
||||||
|
|
||||||
|
docker compose exec db psql -U socialdb -d socialdb-db
|
||||||
|
|||||||
13
drizzle.config.ts
Normal file
13
drizzle.config.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { config } from "dotenv";
|
||||||
|
import { defineConfig } from "drizzle-kit";
|
||||||
|
|
||||||
|
config({ path: ".env" });
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
schema: "./src/db/schema.ts",
|
||||||
|
out: "./src/db/migrations",
|
||||||
|
dialect: "postgresql",
|
||||||
|
dbCredentials: {
|
||||||
|
url: `postgresql://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@localhost:5432/${process.env.POSTGRES_DB}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
8
src/db/drizzle.ts
Normal file
8
src/db/drizzle.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { config } from "dotenv";
|
||||||
|
import { drizzle } from "drizzle-orm/node-postgres";
|
||||||
|
|
||||||
|
config({ path: ".env" });
|
||||||
|
|
||||||
|
export const db = drizzle(
|
||||||
|
`postgresql://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@localhost:5432/${process.env.POSTGRES_DB}`,
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user