@@ -28,19 +28,25 @@ def get_naming_convention():
2828
2929def upgrade () -> None :
3030 naming_convention = get_naming_convention ()
31+ dialect_name = context .get_context ().dialect .name
3132
3233 with op .batch_alter_table ('distribution_txs' , schema = None , naming_convention = naming_convention ) as batch_op :
33- batch_op .drop_constraint (None , type_ = 'primary' ) # type: ignore
34+ constraint_name = 'distribution_txs_pkey' if dialect_name == 'postgresql' else None
35+ batch_op .drop_constraint (constraint_name , type_ = 'primary' ) # type: ignore
3436 batch_op .create_primary_key (batch_op .f ('pk_distribution_txs' ), ['paging_token' ])
3537 batch_op .drop_index (batch_op .f ('idx_dtx_toid' ))
3638 batch_op .create_index ('idx_dtx_hash' , ['hash' ], unique = False )
3739
3840 with op .batch_alter_table ('test_distribution_txs' , schema = None , naming_convention = naming_convention ) as batch_op :
39- batch_op .drop_constraint (None , type_ = 'primary' ) # type: ignore
41+ constraint_name = 'test_distribution_txs_pkey' if dialect_name == 'postgresql' else None
42+ batch_op .drop_constraint (constraint_name , type_ = 'primary' ) # type: ignore
4043 batch_op .create_primary_key (batch_op .f ('pk_test_distribution_txs' ), ['paging_token' ])
4144
4245
4346def downgrade () -> None :
47+ """
48+ Downgrade will fail if there are multiple outflows with the same tx hash.
49+ """
4450 naming_convention = get_naming_convention ()
4551
4652 with op .batch_alter_table ('distribution_txs' , schema = None , naming_convention = naming_convention ) as batch_op :
0 commit comments