Commit 2aee21dc authored by Lukáš Lalinský's avatar Lukáš Lalinský

Add updated columns

parent eb448b61
......@@ -70,6 +70,7 @@ application = Table('application', metadata,
track = Table('track', metadata,
Column('id', Integer, primary_key=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('new_id', Integer, ForeignKey('track.id')),
Column('gid', UUID, nullable=False),
Index('track_idx_gid', 'gid', unique=True),
......@@ -229,6 +230,7 @@ fingerprint = Table('fingerprint', metadata,
Column('bitrate', SmallInteger, CheckConstraint('bitrate>0')),
Column('format_id', Integer),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('submission_count', Integer, nullable=False),
Index('fingerprint_idx_length', 'length'),
......@@ -250,6 +252,7 @@ track_mbid = Table('track_mbid', metadata,
Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('mbid', UUID, nullable=False, index=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('id', Integer, primary_key=True),
Column('submission_count', Integer, nullable=False),
Column('disabled', Boolean, default=False, server_default=sql.false(), nullable=False),
......@@ -280,6 +283,7 @@ track_puid = Table('track_puid', metadata,
Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('puid', UUID, nullable=False, index=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('id', Integer, primary_key=True),
Column('submission_count', Integer, nullable=False),
Index('track_puid_idx_uniq', 'track_id', 'puid', unique=True),
......@@ -300,6 +304,7 @@ track_meta = Table('track_meta', metadata,
Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('meta_id', Integer, ForeignKey('meta.id'), nullable=False, index=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('submission_count', Integer, nullable=False),
Index('track_meta_idx_uniq', 'track_id', 'meta_id', unique=True),
info={'bind_key': 'fingerprint'},
......@@ -319,6 +324,7 @@ track_foreignid = Table('track_foreignid', metadata,
Column('track_id', Integer, ForeignKey('track.id'), nullable=False),
Column('foreignid_id', Integer, ForeignKey('foreignid.id'), nullable=False, index=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Column('updated', DateTime(timezone=True)),
Column('submission_count', Integer, nullable=False),
Index('track_foreignid_idx_uniq', 'track_id', 'foreignid_id', unique=True),
info={'bind_key': 'fingerprint'},
......
"""add updated columns
Revision ID: af7eba7cd108
Revises: d2176bc400c8
Create Date: 2019-12-02 07:44:04.212957
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'af7eba7cd108'
down_revision = 'd2176bc400c8'
branch_labels = None
depends_on = None
def upgrade(engine_name):
globals()["upgrade_%s" % engine_name]()
def downgrade(engine_name):
globals()["downgrade_%s" % engine_name]()
def upgrade_app():
pass
def downgrade_app():
pass
def upgrade_ingest():
pass
def downgrade_ingest():
pass
def upgrade_fingerprint():
op.add_column(u'fingerprint', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
op.add_column(u'track_foreignid', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
op.add_column(u'track_mbid', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
op.add_column(u'track_meta', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
op.add_column(u'track_puid', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
def downgrade_fingerprint():
op.drop_column(u'track_puid', 'updated')
op.drop_column(u'track_meta', 'updated')
op.drop_column(u'track_mbid', 'updated')
op.drop_column(u'track_foreignid', 'updated')
op.drop_column(u'fingerprint', 'updated')
"""add track.updated
Revision ID: b1a71d1125c2
Revises: af7eba7cd108
Create Date: 2019-12-02 07:45:26.771874
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b1a71d1125c2'
down_revision = 'af7eba7cd108'
branch_labels = None
depends_on = None
def upgrade(engine_name):
globals()["upgrade_%s" % engine_name]()
def downgrade(engine_name):
globals()["downgrade_%s" % engine_name]()
def upgrade_app():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade_app():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def upgrade_ingest():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def downgrade_ingest():
# ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
def upgrade_fingerprint():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(u'track', sa.Column('updated', sa.DateTime(timezone=True), nullable=True))
# ### end Alembic commands ###
def downgrade_fingerprint():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column(u'track', 'updated')
# ### end Alembic commands ###
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment