1
0
mirror of https://github.com/civsocit/olgram.git synced 2025-12-18 08:56:17 +00:00

Миграции

This commit is contained in:
mihalin
2021-07-11 12:53:33 +03:00
parent c5e0192d24
commit 415ec12b2f
22 changed files with 435 additions and 233 deletions

View File

@@ -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()