From a0b534fe82f559a3d6c5ef70b278179d8fb6888b Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Tue, 3 Jan 2023 12:04:45 -0500 Subject: [PATCH] s:Rename to `ActiveToken` Need to use the table names in the foreign key reference. --- lib/pbench/server/database/models/active_token.py | 2 +- lib/pbench/server/database/models/dataset.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pbench/server/database/models/active_token.py b/lib/pbench/server/database/models/active_token.py index eaa98dd17e..a6c54f3287 100644 --- a/lib/pbench/server/database/models/active_token.py +++ b/lib/pbench/server/database/models/active_token.py @@ -23,7 +23,7 @@ class ActiveToken(Database.Base): expiration = Column(DateTime, nullable=False, index=True) user_id = Column( Integer, - ForeignKey("user.id", ondelete="CASCADE"), + ForeignKey("users.id", ondelete="CASCADE"), nullable=False, # no need to add index=True, all FKs have indexes ) diff --git a/lib/pbench/server/database/models/dataset.py b/lib/pbench/server/database/models/dataset.py index 90e0fd3cb0..b612e68ce6 100644 --- a/lib/pbench/server/database/models/dataset.py +++ b/lib/pbench/server/database/models/dataset.py @@ -830,7 +830,7 @@ class Metadata(Database.Base): id = Column(Integer, primary_key=True, autoincrement=True) key = Column(String(255), unique=False, nullable=False, index=True) value = Column(JSON, unique=False, nullable=True) - dataset_ref = Column(Integer, ForeignKey("dataset.id"), nullable=False) + dataset_ref = Column(Integer, ForeignKey("datasets.id"), nullable=False) dataset = relationship("Dataset", back_populates="metadatas", single_parent=True) user_id = Column(String(255), nullable=True)