Skip to content
Snippets Groups Projects
Commit 65d397d3 authored by Mohammad Torkashvand's avatar Mohammad Torkashvand
Browse files

alter email in partner table and make it required

parent 19cdf9f9
No related branches found
No related tags found
1 merge request!179alter email in partner table and make it required
......@@ -33,18 +33,19 @@ class PartnerTable(BaseModel):
__tablename__ = "partners"
partner_id = mapped_column(String, server_default=text("uuid_generate_v4"), primary_key=True)
name = mapped_column(String, unique=True)
email = mapped_column(String, unique=True, nullable=True)
name = mapped_column(String, unique=True, nullable=True)
email = mapped_column(String, unique=True, nullable=False)
partner_type = mapped_column(Enum(PartnerType), nullable=False)
as_number = mapped_column(
String, unique=True
String, unique=True, nullable=True
) # the as_number and as_set are mutually exclusive. if you give me one I don't need the other
as_set = mapped_column(String)
as_set = mapped_column(String, nullable=True)
route_set = mapped_column(String, nullable=True)
black_listed_as_sets = mapped_column(ARRAY(String), nullable=True)
additional_routers = mapped_column(ARRAY(String), nullable=True)
additional_bgp_speakers = mapped_column(ARRAY(String), nullable=True)
partner_type = mapped_column(Enum(PartnerType), nullable=False)
created_at = mapped_column(UtcTimestamp, server_default=text("current_timestamp"), nullable=False)
updated_at = mapped_column(
UtcTimestamp, server_default=text("current_timestamp"), nullable=False, onupdate=text("current_timestamp")
......
"""Edit Partner table, Making some fields required.
Revision ID: d61c0f92da1e
Revises: eaed66b04913
Create Date: 2024-03-20 12:29:24.145489
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'd61c0f92da1e'
down_revision = 'eaed66b04913'
branch_labels = None
depends_on = None
def upgrade() -> None:
conn = op.get_bind()
conn.execute(
sa.text(
"""UPDATE partners SET email = 'goat@geant.org' WHERE name='GEANT'"""))
op.alter_column('partners', 'email', existing_type=sa.String(), nullable=False)
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('partners', 'email', existing_type=sa.String(), nullable=True)
# ### end Alembic commands ###
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