forked from Anteros-Code-Mentoria/poc-mvc-ocr
Criação dos models tag e doc_tag
This commit is contained in:
parent
ae963051cb
commit
f94f7a99cd
12
app/models/model-doc_tag.py
Normal file
12
app/models/model-doc_tag.py
Normal file
@ -0,0 +1,12 @@
|
||||
from sqlalchemy import Column, ForeignKey
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
import uuid
|
||||
|
||||
from .base import Base
|
||||
|
||||
class DocTag(Base):
|
||||
__tablename__ = "doc_tag"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
documento_id = Column(UUID(as_uuid=True), ForeignKey("documento.id"), nullable=False)
|
||||
tag_id = Column(UUID(as_uuid=True), ForeignKey("tag.id"), nullable=False)
|
||||
12
app/models/model_tag.py
Normal file
12
app/models/model_tag.py
Normal file
@ -0,0 +1,12 @@
|
||||
from sqlalchemy import Column, String
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
import uuid
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
class Tag(Base):
|
||||
__tablename__ = "tag"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
nome = Column(String, unique=True, nullable=False)
|
||||
Loading…
Reference in New Issue
Block a user