From e6b4dd95e4f048bf98aea55c1c4da47a9a8b7b20 Mon Sep 17 00:00:00 2001 From: "benjamin.747" Date: Mon, 26 May 2025 17:17:55 +0800 Subject: [PATCH] feat(mono): remove sql file & update router with utoipa --- .../docs/development/database/index.mdx | 5 +- .../docs/development/quick-start/index.mdx | 15 +- common/src/model.rs | 6 +- docs/development.md | 19 +- jupiter/callisto/Cargo.toml | 1 + jupiter/callisto/src/sea_orm_active_enums.rs | 9 +- jupiter/sqlite_20241204_init.sql | 1 - jupiter/src/storage/init.rs | 29 +- jupiter/src/storage/mono_storage.rs | 2 +- mono/src/api/api_router.rs | 2 +- mono/src/api/issue/issue_router.rs | 124 +++++-- mono/src/api/issue/mod.rs | 5 +- mono/src/api/mr/mod.rs | 18 +- mono/src/api/mr/mr_router.rs | 205 +++++++---- mono/src/server/https_server.rs | 1 + sql/README.md | 57 --- sql/postgres/pg_20241204__init.sql | 324 ------------------ sql/sqlite/sqlite_20241204_init.sql | 310 ----------------- 18 files changed, 275 insertions(+), 858 deletions(-) delete mode 120000 jupiter/sqlite_20241204_init.sql delete mode 100644 sql/README.md delete mode 100644 sql/postgres/pg_20241204__init.sql delete mode 100644 sql/sqlite/sqlite_20241204_init.sql diff --git a/aria/contents/docs/development/database/index.mdx b/aria/contents/docs/development/database/index.mdx index 754c18519..30000d7ab 100644 --- a/aria/contents/docs/development/database/index.mdx +++ b/aria/contents/docs/development/database/index.mdx @@ -3,12 +3,11 @@ title: Database --- ## Database maintenance -Currently, the tables of database are created by `.sql` file. +Currently, the tables of database are created by [SeaORM migration](https://www.sea-ql.org/SeaORM/docs/migration/setting-up-migration). -If you want to add a new table or modify the existing table, you need to update the `.sql` files which are located in the `sql` directory. +If you want to add a new table or modify the existing table, you need to update the `migration` files which are located in the `jupiter/migration/src` directory. ### Attention -- Each database corresponds to one `.sql` file, you must modify all of them if you want to update the tables in order to keep the consistency of the database. - DO NOT use `Array` Type in PostgreSQL but use `JSON` instead, for compatibility with SQLite & MySQL. (`JSON` <==> `serde_json::Value`) --- diff --git a/aria/contents/docs/development/quick-start/index.mdx b/aria/contents/docs/development/quick-start/index.mdx index c8f22944c..7a7379735 100644 --- a/aria/contents/docs/development/quick-start/index.mdx +++ b/aria/contents/docs/development/quick-start/index.mdx @@ -45,11 +45,6 @@ description: Quick start manuel to developing or testing. postgres=# \q ``` - ```bash - $ cd mega/sql/postgres - $ psql mega < pg_YYYYMMDD_init.sql - ``` - 3. Create user and grant privileges. ```sql @@ -136,14 +131,7 @@ description: Quick start manuel to developing or testing. postgres=# \q ``` - 3.Import `mega/sql/postgres/pg_