Files
fastapi_best_architecture/backend/scripts/init_data.py
Meepoljdx 78dad3021a Add postgresql database support (#475)
* feat: add postgresql db supports

* change: change mysql conn str create way

* fix: Modify the default alembic migration file to meet multi-database support

* Update settings and lint

* update models

* Simplify database config

* Simplify the get db method

* Update create db url

* Updated model type adaptation

* Update sql scripts

* Fix models type

* Adaptation to postgresql code generation

* Update README.md

* Fix alembic file template

* Update docker scripts
2024-12-25 22:04:04 +08:00

25 lines
456 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ruff: noqa: I001
from backend.database.db import create_table
import logging
import sys
from anyio import run
sys.path.append('../')
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
async def init() -> None:
logger.info('Creating initial data')
await create_table()
logger.info('Initial data created')
if __name__ == '__main__':
run(init) # type: ignore