drop ethereum_address of deliverynote
This commit is contained in:
parent
7a88d9d730
commit
b9f3d5976b
|
@ -0,0 +1,34 @@
|
|||
"""change deliverynote
|
||||
|
||||
Revision ID: eca457d8b2a4
|
||||
Revises: 0cbd839b09ef
|
||||
Create Date: 2021-02-03 22:12:41.033661
|
||||
|
||||
"""
|
||||
from alembic import context
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlalchemy_utils
|
||||
import citext
|
||||
import teal
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'eca457d8b2a4'
|
||||
down_revision = '0cbd839b09ef'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def get_inv():
|
||||
INV = context.get_x_argument(as_dictionary=True).get('inventory')
|
||||
if not INV:
|
||||
raise ValueError("Inventory value is not specified")
|
||||
return INV
|
||||
|
||||
def upgrade():
|
||||
op.drop_column('deliverynote', 'ethereum_address', schema=f'{get_inv()}')
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.add_column('deliverynote', sa.Column('ethereum_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')
|
|
@ -46,7 +46,6 @@ class Deliverynote(Thing):
|
|||
transferred_devices = db.Column(db.ARRAY(db.Integer, dimensions=1), nullable=True)
|
||||
transfer_state = db.Column(IntEnum(TransferState), default=TransferState.Initial, nullable=False)
|
||||
transfer_state.comment = TransferState.__doc__
|
||||
ethereum_address = db.Column(CIText(), unique=True, default=None)
|
||||
lot_id = db.Column(UUID(as_uuid=True),
|
||||
db.ForeignKey(Lot.id),
|
||||
nullable=False)
|
||||
|
|
|
@ -21,7 +21,6 @@ class Deliverynote(Thing):
|
|||
date = f.DateTime('iso', required=True)
|
||||
deposit = f.Integer(validate=f.validate.Range(min=0, max=100),
|
||||
description=m.Deliverynote.deposit.__doc__)
|
||||
ethereum_address = f.String(description='User identifier address inside the Blockchain')
|
||||
expected_devices = f.List(f.Dict, required=True, data_key='expectedDevices')
|
||||
transferred_devices = f.List(f.Integer(), required=False, data_key='transferredDevices')
|
||||
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
||||
|
|
|
@ -28,8 +28,7 @@ class DeliverynoteView(View):
|
|||
return ret
|
||||
|
||||
def patch(self, id):
|
||||
patch_schema = self.resource_def.SCHEMA(only=('transfer_state',
|
||||
'ethereum_address'), partial=True)
|
||||
patch_schema = self.resource_def.SCHEMA(only=('transfer_state'), partial=True)
|
||||
d = request.get_json(schema=patch_schema)
|
||||
dlvnote = Deliverynote.query.filter_by(id=id).one()
|
||||
# device_fields = ['transfer_state', 'deliverynote_address']
|
||||
|
|
Reference in a new issue