mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
чиним билд13
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
"""Database connection module"""
|
||||
"""Database configuration"""
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from .config import settings
|
||||
import os
|
||||
|
||||
engine = create_engine(
|
||||
settings.database_url,
|
||||
pool_size=5,
|
||||
max_overflow=10,
|
||||
pool_timeout=30,
|
||||
pool_recycle=1800
|
||||
SQLALCHEMY_DATABASE_URL = os.getenv(
|
||||
"DATABASE_URL",
|
||||
"postgresql://postgres:postgres@postgres/support_db"
|
||||
)
|
||||
|
||||
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
def get_db():
|
||||
|
||||
8
backend/docker/postgres/init.sql
Normal file
8
backend/docker/postgres/init.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Create the postgres superuser
|
||||
CREATE USER postgres WITH PASSWORD 'postgres' SUPERUSER;
|
||||
|
||||
-- Create the database
|
||||
CREATE DATABASE support_db;
|
||||
|
||||
-- Grant privileges
|
||||
GRANT ALL PRIVILEGES ON DATABASE support_db TO postgres;
|
||||
Reference in New Issue
Block a user