инициализация декларативной базы
This commit is contained in:
commit
ce4ef3456f
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
API/.venv
|
||||||
|
API/.idea
|
||||||
|
|
||||||
|
API/.venv/
|
||||||
|
API/.idea/
|
||||||
0
API/app/__init__.py
Normal file
0
API/app/__init__.py
Normal file
0
API/app/application/__init__.py
Normal file
0
API/app/application/__init__.py
Normal file
0
API/app/contollers/__init__.py
Normal file
0
API/app/contollers/__init__.py
Normal file
0
API/app/database/__init__.py
Normal file
0
API/app/database/__init__.py
Normal file
0
API/app/domain/__init__.py
Normal file
0
API/app/domain/__init__.py
Normal file
0
API/app/domain/entities/__init__.py
Normal file
0
API/app/domain/entities/__init__.py
Normal file
3
API/app/domain/models/__init__.py
Normal file
3
API/app/domain/models/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
12
API/app/domain/models/base.py
Normal file
12
API/app/domain/models/base.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from sqlalchemy import Integer, Column, DateTime
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
from app.domain.models import Base
|
||||||
|
|
||||||
|
|
||||||
|
class AdvancedBaseModel(Base):
|
||||||
|
__abstract__ = True
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||||
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False)
|
||||||
10
API/app/domain/models/roles.py
Normal file
10
API/app/domain/models/roles.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from sqlalchemy import Column
|
||||||
|
from sqlalchemy.dialects.mysql import VARCHAR
|
||||||
|
|
||||||
|
from app.domain.models.base import AdvancedBaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class Role(AdvancedBaseModel):
|
||||||
|
__tablename__ = 'roles'
|
||||||
|
|
||||||
|
title = Column(VARCHAR(150), unique=True, nullable=False)
|
||||||
0
API/app/infrastructure/__init__.py
Normal file
0
API/app/infrastructure/__init__.py
Normal file
0
API/app/main.py
Normal file
0
API/app/main.py
Normal file
0
API/app/settings.py
Normal file
0
API/app/settings.py
Normal file
0
API/req.txt
Normal file
0
API/req.txt
Normal file
Loading…
x
Reference in New Issue
Block a user