<gh_stars>100-1000
"""Saves table 2

Revision ID: 9e9acd8a115a
Revises: eab2c0a9b338
Create Date: 2019-03-04 20:05:39.877210

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "9e9acd8a115a"
down_revision = "eab2c0a9b338"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "saves",
        sa.Column("blockhash", sa.String(), nullable=False),
        sa.Column("blocknumber", sa.Integer(), nullable=False),
        sa.Column("user_id", sa.Integer(), nullable=False),
        sa.Column("save_item_id", sa.Integer(), nullable=False),
        sa.Column(
            "save_type",
            sa.Enum("track", "playlist", "album", name="savetype"),
            nullable=False,
        ),
        sa.Column("timestamp", sa.DateTime(), nullable=False),
        sa.Column("is_current", sa.Boolean(), nullable=False),
        sa.Column("is_delete", sa.Boolean(), nullable=False),
        sa.ForeignKeyConstraint(
            ["blockhash"],
            ["blocks.blockhash"],
        ),
        sa.ForeignKeyConstraint(
            ["blocknumber"],
            ["blocks.number"],
        ),
        sa.PrimaryKeyConstraint(
            "is_current", "user_id", "save_item_id", "save_type", "blockhash"
        ),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("saves")
    # ### end Alembic commands ###

"""Saves table 2

Revision ID: 9e9acd8a115a
Revises: eab2c0a9b338
Create Date: 2019-03-04 20:05:39.877210

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "9e9acd8a115a"
down_revision = "eab2c0a9b338"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "saves",
        sa.Column("blockhash", sa.String(), nullable=False),
        sa.Column("blocknumber", sa.Integer(), nullable=False),
        sa.Column("user_id", sa.Integer(), nullable=False),
        sa.Column("save_item_id", sa.Integer(), nullable=False),
        sa.Column(
            "save_type",
            sa.Enum("track", "playlist", "album", name="savetype"),
            nullable=False,
        ),
        sa.Column("timestamp", sa.DateTime(), nullable=False),
        sa.Column("is_current", sa.Boolean(), nullable=False),
        sa.Column("is_delete", sa.Boolean(), nullable=False),
        sa.ForeignKeyConstraint(
            ["blockhash"],
            ["blocks.blockhash"],
        ),
        sa.ForeignKeyConstraint(
            ["blocknumber"],
            ["blocks.number"],
        ),
        sa.PrimaryKeyConstraint(
            "is_current", "user_id", "save_item_id", "save_type", "blockhash"
        ),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("saves")
    # ### end Alembic commands ###
Saves table 2  Revision ID: 9e9acd8a115a Revises: eab2c0a9b338 Create Date: 2019-03-04 20:05:39.877210 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###