Add backend scripts description (#309)

This commit is contained in:
Wu Clan
2024-03-31 19:48:58 +08:00
committed by GitHub
parent 8a165ec181
commit 406116a230
5 changed files with 27 additions and 1 deletions

View File

@@ -58,3 +58,21 @@
5. Commit and push your changes
Commit your changes, push your branch to GitHub, and create a pull request.
## Scripts
> [!WARNING]
>
> The following script may not apply to the Windows platform
>
> It is recommended to execute under the backend directory, and chmod authorization may be required
- `pre_start.sh`: Perform automatic database migration and create database tables
- `celery-start.sh`: For celery docker script, implementation is not recommended
- `format.sh`: Perform ruff format check
- `lint.sh`: Perform pre-commit formatting
- `pdm_export.sh`: Execute pdm export dependency package

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ruff: noqa: I001
import asyncio
import os
import sys

2
backend/pre_start.sh Normal file → Executable file
View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
alembic revision --autogenerate
alembic upgrade head
python ./scripts/init_data.py

View File

@@ -61,7 +61,7 @@ deploy = [
]
[tool.pdm]
package-type = "application"
distribution = false
[tool.pdm.scripts]
lint = "pre-commit run --all-files"

View File

@@ -1,9 +1,13 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ruff: noqa: I001
import logging
import sys
from anyio import run
sys.path.append('../')
from backend.database.db_mysql import create_table
logging.basicConfig(level=logging.INFO)