Skip to content

Commit 31ee04e

Browse files
committed
Merge branch 'new-dev-demo' of https://github.com/devforth/adminforth into new-dev-demo
2 parents 9aebd42 + 3710c1f commit 31ee04e

File tree

21 files changed

+74
-9
lines changed

21 files changed

+74
-9
lines changed

dev-demo/.db.sqlite-journal

512 Bytes
Binary file not shown.

dev-demo/.env.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ADMINFORTH_SECRET=123
22
NODE_ENV=development
3-
SQLITE_URL=sqlite://.db.sqlite
4-
SQLITE_FILE_URL=file:.db.sqlite
3+
SQLITE_URL=sqlite://prisma/sqlite/.db.sqlite
4+
SQLITE_FILE_URL=file:./prisma/sqlite/.db.sqlite
55

66
AWS_REGION=eu-central-1
77
AWS_BUCKET_NAME=tmpbucket-adminforth

dev-demo/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const admin = new AdminForth({
103103
usersResource,
104104
auditLogsResource,
105105
cars_SQLITE_resource,
106-
// cars_MyS_resource,
106+
cars_MyS_resource,
107107
// cars_PG_resource,
108108
cars_Mongo_resource,
109109
// cars_Ch_resource,
@@ -132,10 +132,10 @@ export const admin = new AdminForth({
132132
resourceId: 'cars_sl',
133133
homepage: true,
134134
},
135-
// {
136-
// label: 'Cars (MySQL)',
137-
// resourceId: 'cars_mysql',
138-
// },
135+
{
136+
label: 'Cars (MySQL)',
137+
resourceId: 'cars_mysql',
138+
},
139139
// {
140140
// label: 'Cars (PostgreSQL)',
141141
// resourceId: 'cars_pg',

dev-demo/inventory.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ services:
5252
MYSQL_PASSWORD: demo
5353
volumes:
5454
- mysql-data:/var/lib/mysql
55+
- ./prisma/mysql/mysql-init:/docker-entrypoint-initdb.d
5556

5657
keycloak:
5758
image: quay.io/keycloak/keycloak:latest
@@ -70,6 +71,24 @@ services:
7071
- pg
7172
volumes:
7273
- keycloak-data:/opt/keycloak/data
74+
init-db:
75+
image: mysql
76+
depends_on:
77+
- mysql
78+
environment:
79+
MYSQL_ROOT_PASSWORD: demo
80+
command: >
81+
bash -c "
82+
until mysql -h mysql -P 3306 -u root -pdemo -e 'SELECT 1'; do
83+
sleep 2;
84+
done;
85+
86+
mysql -h mysql -P 3306 -u root -pdemo -e 'CREATE DATABASE IF NOT EXISTS demo;';
87+
88+
mysql -h mysql -P 3306 -u root -pdemo -e \"CREATE USER IF NOT EXISTS 'demo'@'%' IDENTIFIED BY 'demo';\"
89+
mysql -h mysql -P 3306 -u root -pdemo -e \"GRANT CREATE, ALTER, DROP, REFERENCES ON *.* TO 'demo'@'%';\"
90+
mysql -h mysql -P 3306 -u root -pdemo -e 'FLUSH PRIVILEGES;'
91+
"
7392
7493
7594
volumes:

dev-demo/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
"scripts": {
88
"_env:dev": "dotenvx run -f .env.local -f .env --overload --",
99
"start": "npm run _env:dev -- tsx watch index.ts",
10-
"makemigration": "npm run _env:dev -- npx --yes prisma migrate dev --create-only",
11-
"migrate:local": "npm run _env:dev -- npx --yes prisma migrate deploy",
10+
"makemigration:sqlite": "npm run _env:dev -- npx --yes prisma migrate dev --create-only --schema=./prisma/sqlite/schema.prisma",
11+
"migrate:sqlite": "npm run _env:dev -- npx --yes prisma migrate deploy --schema=./prisma/sqlite/schema.prisma",
12+
13+
"makemigration:mysql": "npm run _env:dev -- npx --yes prisma migrate dev --create-only --schema=./prisma/mysql/schema.mysql.prisma",
14+
"migrate:mysql": "npm run _env:dev -- npx --yes prisma migrate deploy --schema=./prisma/mysql/schema.mysql.prisma",
15+
1216
"install-plugins": "cd ../plugins && bash install-plugins.sh",
1317
"install-adapters": "cd ../adapters && bash install-adapters.sh"
1418
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import 'dotenv/config'
2+
import { defineConfig, env } from 'prisma/config'
3+
4+
export default defineConfig({
5+
datasource: {
6+
url: 'mysql://demo:demo@localhost:3307/demo',
7+
},
8+
})
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
generator client {
2+
provider = "prisma-client-js"
3+
}
4+
5+
datasource mysql_db {
6+
provider = "mysql"
7+
url = "mysql://demo:demo@localhost:3307/demo"
8+
}
9+
10+
model cars {
11+
id String @id
12+
model String
13+
price Float
14+
created_at DateTime @default(now())
15+
16+
engine_type String?
17+
engine_power Int?
18+
production_year Int?
19+
20+
description String?
21+
listed Boolean @default(false)
22+
mileage Float?
23+
color String?
24+
body_type String?
25+
26+
photos String?
27+
28+
seller_id String?
29+
seller String?
30+
31+
promo_picture String?
32+
generated_promo_picture String?
33+
34+
}

dev-demo/migrations/20251224103234_init/migration.sql renamed to dev-demo/prisma/sqlite/migrations/20251224103234_init/migration.sql

File renamed without changes.

dev-demo/migrations/20251224120206_add_cars_model/migration.sql renamed to dev-demo/prisma/sqlite/migrations/20251224120206_add_cars_model/migration.sql

File renamed without changes.

dev-demo/migrations/20251225073008_add_audit_logs/migration.sql renamed to dev-demo/prisma/sqlite/migrations/20251225073008_add_audit_logs/migration.sql

File renamed without changes.

0 commit comments

Comments
 (0)