mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-18 08:56:17 +00:00
Миграции
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
from tortoise import Tortoise
|
||||
from olgram.settings import DatabaseSettings
|
||||
|
||||
|
||||
async def init_database():
|
||||
# Here we create a SQLite DB using file "db.sqlite3"
|
||||
# also specify the app name of "models"
|
||||
# which contain models from "app.models"
|
||||
await Tortoise.init(
|
||||
db_url=f'postgres://{DatabaseSettings.user()}:{DatabaseSettings.password()}'
|
||||
f'@localhost:5430/{DatabaseSettings.database_name()}',
|
||||
modules={'models': ['olgram.models.models']}
|
||||
)
|
||||
# Generate the schema
|
||||
await Tortoise.generate_schemas()
|
||||
Reference in New Issue
Block a user