Skip to content

Commit d9a2194

Browse files
committed
chore: update setup-dev-demo script and add migrate:all command for comprehensive migration support
1 parent 4227793 commit d9a2194

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

README.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,44 +61,50 @@ npx adminforth create-app
6161

6262
The most convenient way to add new features or fixes is using `dev-demo`. It imports the source code of the repository and plugins so you can edit them and see changes on the fly.
6363

64-
Fork repo, pull it and do next:
64+
To run dev demo:
65+
```sh
66+
cd dev-demo
6567

68+
npm run setup-dev-demo
69+
npm run migrate:all
6670

67-
```sh
68-
cd adminforth
69-
npm ci
70-
npm run build
71+
npm start
7172
```
7273

73-
To run dev demo:
74-
```sh
75-
cd dev-demo
76-
cp .env.sample .env
74+
## Adding columns to a database in dev-demo
7775

78-
# this will install all official plugins and link adminforth package, if plugin installed it will git pull and npm ci
79-
npm run install-plugins
76+
Open `./migrations` folder. There is prisma migration folder for the sqlite, postgres and mysql and `clickhouse_migrations` folder for the clickhouse:
8077

81-
# same for official adapters
82-
npm run install-adapters
78+
### Migrations for the MySQL, SQLite and Postgres
79+
To make migration add to the .prisma file in folder with database you need and add new tables or columns. Then run:
8380

84-
npm ci
8581

86-
./run_inventory.sh
82+
```
83+
npm run makemigration:sqlite -- --name init
84+
```
85+
86+
and
8787

88-
npm run migrate:local
89-
npm start
88+
```
89+
npm run migrate:sqlite
9090
```
9191

92-
## Adding columns to a database in dev-demo
92+
to apply migration
93+
94+
> use :sqlite, :mysql or :postgres for you case
95+
96+
### Migrations for the clickhouse
9397

94-
Open `.prisma` file, modify it, and run:
98+
In order to make migration for the clickhouse, go to the `./migrations/clickhouse_migrations` folder and add migration file to the folder.
9599

100+
Then run
96101
```
97-
npm run namemigration -- --name desctiption_of_changes
102+
npm run migrate:clickhouse
98103
```
99104

105+
to apply the migration.
100106

101-
### Testing CLI commands during development
107+
## Testing CLI commands during development
102108

103109

104110
Make sure you have not `adminforth` globally installed. If you have it, remove it:

dev-demo/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
"install-plugins": "cd ../plugins && bash install-plugins.sh",
2323
"install-adapters": "cd ../adapters && bash install-adapters.sh",
2424

25-
"build-adminforth": "cd ../ && npm ci && npm run build ",
25+
"build-adminforth": "cd ../adminforth && npm ci && npm run build ",
26+
27+
"migrate:all": "npm run migrate:sqlite && npm run migrate:mysql && npm run migrate:postgres && npm run migrate:clickhouse",
2628

27-
"setup-dev-demo": "npm run build-adminforth && cp .env.local .env && npm run install-plugins && npm run install-adapters && npm install && bash ./run_inventory.sh && npm run migrate:sqlite && npm run migrate:mysql && npm run migrate:postgres && npm run migrate:clickhouse"
29+
"setup-dev-demo": "npm run build-adminforth && npm link adminforth && cp .env.local .env && npm run install-plugins && npm run install-adapters && npm install && bash ./run_inventory.sh"
2830
},
2931
"author": "",
3032
"license": "ISC",

0 commit comments

Comments
 (0)