Skip to content

Commit

Permalink
migrate to postgres from sqlite (#9)
Browse files Browse the repository at this point in the history
* feat: migrate to pgsql

use googleId as primaryKey in the user table

* fix: migrate futher
  • Loading branch information
listlessbird authored Nov 4, 2024
1 parent 81c670d commit 23d6718
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 618 deletions.
2 changes: 1 addition & 1 deletion web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CF_ACCOUNT_ID=
BUCKET_NAME=
ASSEMBLY_API_KEY=
REPLICATE_API_KEY=
D1_ID=
DB_URL=
CF_ID=
D1_KEY=
GOOGLE_CLIENT_ID=
Expand Down
7 changes: 3 additions & 4 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env
.env*
!.env.example

# vercel
.vercel
Expand All @@ -42,5 +42,4 @@ next-env.d.ts
scratch.ts

secrets.ps1
fly.toml
.env.prod
fly.toml
Binary file modified web/bun.lockb
Binary file not shown.
21 changes: 21 additions & 0 deletions web/compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: sparkles-web
services:
postgres:
image: postgres
restart: always
environment:
- POSTGRES_DB=sparkles-db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data

volumes:
pg_data:
7 changes: 2 additions & 5 deletions web/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { defineConfig } from "drizzle-kit";
export default defineConfig({
schema: "./src/db/schema.ts",
out: "./migrations",
dialect: "sqlite",
driver: "d1-http",
dialect: "postgresql",
dbCredentials: {
accountId: process.env.CF_ID!,
databaseId: process.env.D1_ID!,
token: process.env.D1_KEY!,
url: process.env.DB_URL!,
},
});
54 changes: 0 additions & 54 deletions web/migrations/0000_cheerful_blob.sql

This file was deleted.

Loading

0 comments on commit 23d6718

Please sign in to comment.