#5079 Make the token_id column of the commit_flags table nullable
Merged 3 years ago by pingou. Opened 3 years ago by pingou.

@@ -0,0 +1,33 @@ 

+ """token_if in commit flag can be null

+ 

+ Revision ID: c0bffa4e8fbc

+ Revises: 2b39a728a38f

+ Create Date: 2021-01-08 11:12:45.380762

+ 

+ """

+ 

+ from alembic import op

+ import sqlalchemy as sa

+ 

+ 

+ # revision identifiers, used by Alembic.

+ revision = 'c0bffa4e8fbc'

+ down_revision = '2b39a728a38f'

+ 

+ 

+ def upgrade():

+     op.alter_column(

+         'commit_flags',

+         column_name='token_id',

+         nullable=False,

+         existing_nullable=True

+     )

+ 

+ 

+ def downgrade():

+     op.alter_column(

+         'commit_flags',

+         column_name='token_id',

+         nullable=True,

+         existing_nullable=False

+     )

file modified
+3 -1
@@ -2552,7 +2552,9 @@ 

          index=True,

      )

      token_id = sa.Column(

-         sa.String(64), sa.ForeignKey("tokens.id"), nullable=False

+         sa.String(64),

+         sa.ForeignKey("tokens.id", ondelete="CASCADE", onupdate="CASCADE"),

+         nullable=True,

      )

      user_id = sa.Column(

          sa.Integer,

We need this as flags set from the CI integration do not use tokens
and thus can't provide one.

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto 6141a317f940e36439b57b4a54c177ff2ea77d6f

3 years ago

rebased onto 953d7ffcf2f929e964f6ace2176cfbb402e276d6

3 years ago

I'm going to merge this on the 3999 jenkins run is over as it's not being tested anyway

rebased onto 1815160

3 years ago

Pull-Request has been merged by pingou

3 years ago