Add created column to blob upload

Fixes first half of #1054
This commit is contained in:
Joseph Schorr 2015-12-14 15:26:15 -05:00
parent 54095eb5cb
commit 9698d6f6a0
2 changed files with 28 additions and 0 deletions

View file

@ -786,6 +786,7 @@ class BlobUpload(BaseModel):
storage_metadata = JSONField(null=True, default={})
chunk_count = IntegerField(default=0)
uncompressed_byte_count = IntegerField(null=True)
created = DateTimeField(default=datetime.now, index=True)
class Meta:
database = db

View file

@ -0,0 +1,27 @@
"""Add created field to the BlobUpload table
Revision ID: 88e0f440a2f
Revises: 403d02fea323
Create Date: 2015-12-14 15:19:11.825279
"""
# revision identifiers, used by Alembic.
revision = '88e0f440a2f'
down_revision = '403d02fea323'
from alembic import op
import sqlalchemy as sa
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.add_column('blobupload', sa.Column('created', sa.DateTime(), nullable=False, server_default=sa.text('now()')))
op.create_index('blobupload_created', 'blobupload', ['created'], unique=False)
### end Alembic commands ###
def downgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.drop_index('blobupload_created', table_name='blobupload')
op.drop_column('blobupload', 'created')
### end Alembic commands ###