Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .config/mysql/init.sql

This file was deleted.

6 changes: 6 additions & 0 deletions .config/postgres/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Create test database
CREATE DATABASE dashbore_test;

-- Grant all privileges
GRANT ALL PRIVILEGES ON DATABASE dashbore TO dashbore;
GRANT ALL PRIVILEGES ON DATABASE dashbore_test TO dashbore;
27 changes: 14 additions & 13 deletions .github/workflows/bun-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ jobs:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8
postgres:
image: postgres:17
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dashbore
POSTGRES_USER: dashbore
POSTGRES_PASSWORD: dashbore
POSTGRES_DB: dashbore_test
ports:
- 3306:3306
- 5432:5432
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
Expand All @@ -36,7 +37,7 @@ jobs:
--health-retries 5

env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/dashbore
DATABASE_URL: postgresql://dashbore:dashbore@127.0.0.1:5432/dashbore_test
JWT_SECRET: supersecret
REDIS_URL: redis://localhost:6379

Expand All @@ -48,10 +49,10 @@ jobs:
- name: Install dependencies
run: bun install

- name: Wait for MySQL to be ready
- name: Wait for PostgreSQL to be ready
run: |
until mysqladmin ping -h 127.0.0.1 -uroot -proot --silent; do
echo "Waiting for MySQL..."
until pg_isready -h 127.0.0.1 -U dashbore; do
echo "Waiting for PostgreSQL..."
sleep 3
done

Expand Down
2 changes: 1 addition & 1 deletion apps/api/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Prisma configuration
DATABASE_URL="mysql://dashbore:dashbore@localhost:3306/dashbore"
DATABASE_URL="postgresql://dashbore:dashbore@localhost:5432/dashbore"

# JWT configuration
JWT_SECRET="secret"
Expand Down
2 changes: 1 addition & 1 deletion apps/api/.env.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Database configuration
DATABASE_URL=mysql://dashbore:dashbore@localhost:3306/dashbore_test
DATABASE_URL=postgresql://dashbore:dashbore@localhost:5432/dashbore_test

# JWT configuration
JWT_SECRET="secret"
Expand Down
50 changes: 35 additions & 15 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@ services:

# Database and adminer
db:
image: mysql:8
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dashbore
MYSQL_USER: dashbore
MYSQL_PASSWORD: dashbore
image: postgres:17
container_name: dashbore-postgres
restart: unless-stopped
ports:
- 3306:3306
- "5432:5432"
environment:
POSTGRES_USER: dashbore
POSTGRES_PASSWORD: dashbore
POSTGRES_DB: dashbore
volumes:
- .config/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
- .data/mysql:/var/lib/mysql
- .config/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
- .data/postgres:/var/lib/postgresql/data
networks:
- dashbore-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dashbore -d dashbore"]
interval: 10s
timeout: 5s
retries: 5

adminer:
image: adminer:latest
Expand Down
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"seed": "prisma db seed"
},
"dependencies": {
"@prisma/adapter-mariadb": "latest",
"@prisma/adapter-pg": "^7.0.0",
"@prisma/client": "^7.0.0",
"prisma": "^7.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/database/prisma.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default defineConfig({
seed: "bun run prisma/seed.ts",
},
datasource: {
url: process.env.DATABASE_URL ?? "mysql://dashbore:dashbore@localhost:3306/dashbore",
url: process.env.DATABASE_URL ?? "postgresql://dashbore:dashbore@localhost:5432/dashbore",
},
});

This file was deleted.

This file was deleted.

Loading
Loading