Skip to content
Snippets Groups Projects
Commit 07c5fd2e authored by Nicolas Schmid's avatar Nicolas Schmid
Browse files

fix: change id's to bigint

parent 6e8e3827
No related tags found
No related merge requests found
Pipeline #3871 passed
......@@ -3,7 +3,8 @@ import functools
import uuid
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Float, Integer, String
from sqlalchemy import (BigInteger, Boolean, Column, DateTime, Float, Integer,
String)
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import declarative_base
......@@ -17,7 +18,11 @@ class Base(object):
@declared_attr
def __tablename__(cls):
return cls.__name__.lower()
_oid = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
_oid = Column(
BigInteger,
primary_key=True,
nullable=False,
autoincrement=True)
ORMBase = declarative_base(cls=Base)
......
from sqlalchemy import Boolean, Column, ForeignKey, Index, Integer, String
from sqlalchemy import BigInteger, Boolean, Column, ForeignKey, Index, String
from sqlalchemy.orm import relationship
from hydws.datamodel.base import (CreationInfoMixin, EpochMixin, ORMBase,
......@@ -73,7 +73,7 @@ class BoreholeSection(EpochMixin('Epoch', epoch_type='finite'),
description = Column(String)
_borehole_oid = Column(
Integer,
BigInteger,
ForeignKey('borehole._oid', ondelete="CASCADE"),
index=True)
......@@ -107,7 +107,7 @@ class HydraulicSample(TimeQuantityMixin('datetime', value_nullable=False,
fluidcomposition = Column(String)
_boreholesection_oid = Column(
Integer,
BigInteger,
ForeignKey('boreholesection._oid', ondelete="CASCADE"),
index=True)
section = relationship("BoreholeSection", back_populates="hydraulics")
......
......@@ -141,9 +141,9 @@ def csv_response(data) -> PlainTextResponse:
return PlainTextResponse(data, media_type='text/csv')
@ router.get("/{borehole_id}/sections/{section_id}/hydraulics",
response_model=list[HydraulicSampleSchema],
response_model_exclude_none=True)
@router.get("/{borehole_id}/sections/{section_id}/hydraulics",
response_model=list[HydraulicSampleSchema],
response_model_exclude_none=True)
async def get_section_hydraulics(borehole_id: uuid.UUID,
section_id: uuid.UUID,
db: DBSessionDep,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment