Skip to content

Commit

Permalink
Fix ProjectAssignment primary keys
Browse files Browse the repository at this point in the history
It should be a composed primary key of user and project, not
just the user id.
  • Loading branch information
anarute committed Dec 18, 2023
1 parent 33b8cc3 commit 2a26d57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def upgrade() -> None:
sa.Column('projectid', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['projectid'], ['project.id'], ),
sa.ForeignKeyConstraint(['usrid'], ['usr.id'], ),
sa.PrimaryKeyConstraint('usrid')
sa.PrimaryKeyConstraint('usrid', 'projectid')
)

# ----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion api/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class ProjectAssignment(Base):
__tablename__ = "project_usr"

user = Column("usrid", Integer, ForeignKey("usr.id"), nullable=False, primary_key=True)
project = Column("projectid", Integer, ForeignKey("project.id"), nullable=False)
project = Column("projectid", Integer, ForeignKey("project.id"), nullable=False, primary_key=True)

0 comments on commit 2a26d57

Please sign in to comment.