Skip to content

Commit

Permalink
make display_name not nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Dec 14, 2024
1 parent 540f3b8 commit 1e1d8c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("project", sa.Column("display_name", sa.String(), nullable=True))
op.add_column(
"project", sa.Column("display_name", sa.String(), server_default="", nullable=False)
)

# Copy data from 'name' column to 'display_name' column
op.execute("UPDATE project SET display_name = name")
Expand Down
4 changes: 2 additions & 2 deletions src/dispatch/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Project(Base):
cascade="all, delete-orphan",
)

display_name = Column(String, nullable=True)
display_name = Column(String, nullable=False, server_default="")

enabled = Column(Boolean, default=True, server_default="t")
allow_self_join = Column(Boolean, default=True, server_default="t")
Expand Down Expand Up @@ -84,7 +84,7 @@ def slug(self):
class ProjectBase(DispatchBase):
id: Optional[PrimaryKey]
name: NameStr
display_name: Optional[str] = Field(None, nullable=True)
display_name: Optional[str] = Field("", nullable=False)
owner_email: Optional[EmailStr] = Field(None, nullable=True)
owner_conversation: Optional[str] = Field(None, nullable=True)
annual_employee_cost: Optional[int]
Expand Down

0 comments on commit 1e1d8c2

Please sign in to comment.