mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-15 12:50:47 +02:00
Add unique constraint hash received offer (#732)
* Add unique constraint on payment hash in received offers table * Fix unique constraint
This commit is contained in:
parent
26beeda41e
commit
43480865fe
2 changed files with 34 additions and 1 deletions
|
|
@ -0,0 +1,33 @@
|
|||
"""Add unique constraint on payment hash of received offer
|
||||
|
||||
Revision ID: cd3f18ee33c8
|
||||
Revises: df59995f322c
|
||||
Create Date: 2021-01-27 17:40:06.995928
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'cd3f18ee33c8'
|
||||
down_revision = 'df59995f322c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('received_offer', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(
|
||||
'uq_received_offer_payment_hash', ['payment_hash'])
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('received_offer', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(
|
||||
'uq_received_offer_payment_hash', type_='unique')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -87,7 +87,7 @@ class Models:
|
|||
Column("created", TZDateTime,
|
||||
server_default=func.now(), nullable=False),
|
||||
Column("squeak_hash", String(64), nullable=False),
|
||||
Column("payment_hash", String(64), nullable=False),
|
||||
Column("payment_hash", String(64), unique=True, nullable=False),
|
||||
Column("nonce", String(64), nullable=False),
|
||||
Column("payment_point", String(66), nullable=False),
|
||||
Column("invoice_timestamp", Integer, nullable=False),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue