2
0
forked from kodorvan/stcs

Creating a new database

This commit is contained in:
algizn97
2025-11-10 09:44:29 +05:00
parent 34922e6998
commit d7b558664b
3 changed files with 2 additions and 34 deletions

View File

@@ -84,7 +84,7 @@ path_separator = os
# database URL. This is consumed by the user-maintained env.py script only. # database URL. This is consumed by the user-maintained env.py script only.
# other means of configuring database URLs may be customized within the env.py # other means of configuring database URLs may be customized within the env.py
# file. # file.
sqlalchemy.url = sqlite+aiosqlite:///./database/dbases/stcs.db sqlalchemy.url = sqlite+aiosqlite:///./database/dbs/stcs.db
[post_write_hooks] [post_write_hooks]

View File

@@ -1,32 +0,0 @@
"""Create new database
Revision ID: dd8d3ee75389
Revises:
Create Date: 2025-11-09 15:16:52.424676
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'dd8d3ee75389'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###

View File

@@ -10,7 +10,7 @@ logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger("database") logger = logging.getLogger("database")
BASE_DIR = Path(__file__).parent.resolve() BASE_DIR = Path(__file__).parent.resolve()
DATA_DIR = BASE_DIR / "dbases" DATA_DIR = BASE_DIR / "dbs"
DATA_DIR.mkdir(parents=True, exist_ok=True) DATA_DIR.mkdir(parents=True, exist_ok=True)
DATABASE_URL = f"sqlite+aiosqlite:///{DATA_DIR / 'stcs.db'}" DATABASE_URL = f"sqlite+aiosqlite:///{DATA_DIR / 'stcs.db'}"