text: """Add collections
  
  Revision ID: 4cf7750200d9
  Revises: a1f1e9336ecf
  Create Date: 2020-08-31 17:32:40.957859
  
  """
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import postgresql
  
  # revision identifiers, used by Alembic.
  revision = "4cf7750200d9"
  down_revision = "a1f1e9336ecf"
  branch_labels = None
  depends_on = None
  
  
  def upgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table(
          "post",
          sa.Column("id", sa.Integer(), nullable=False),
          sa.Column("title", sa.String(length=64), nullable=True),
          sa.Column("author_id", sa.Integer(), nullable=True),
          sa.Column("slug", sa.String(length=128), nullable=True),
          sa.Column("date", sa.String(length=64), nullable=True),
          sa.Column("content", sa.Text(), nullable=True),
          sa.Column("timestamp", sa.DateTime(), nullable=True),
          sa.ForeignKeyConstraint(
              ["author_id"],
              ["user.id"],
          ),
          sa.PrimaryKeyConstraint("id"),
      )
      op.create_index(op.f("ix_post_timestamp"), "post", ["timestamp"], unique=False)
      op.create_index(op.f("ix_post_title"), "post", ["title"], unique=False)
      op.create_table(
          "collect",
          sa.Column("collector_id", sa.Integer(), nullable=False),
          sa.Column("collected_id", sa.Integer(), nullable=False),
          sa.Column("timestamp", sa.DateTime(), nullable=True),
          sa.ForeignKeyConstraint(
              ["collected_id"],
              ["post.id"],
          ),
          sa.ForeignKeyConstraint(
              ["collector_id"],
              ["user.id"],
          ),
          sa.PrimaryKeyConstraint("collector_id", "collected_id"),
      )
      op.drop_index("ix_posts_timestamp", table_name="posts")
      op.drop_index("ix_posts_title", table_name="posts")
      op.drop_table("posts")
      # ### end Alembic commands ###
  
  
  def downgrade():
      # ### commands auto generated by Alembic - please adjust! ###
      op.create_table(
          "posts",
          sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
          sa.Column("title", sa.VARCHAR(length=64), autoincrement=False, nullable=True),
          sa.Column("author_id", sa.INTEGER(), autoincrement=False, nullable=True),
          sa.Column("slug", sa.VARCHAR(length=128), autoincrement=False, nullable=True),
          sa.Column("date", sa.VARCHAR(length=64), autoincrement=False, nullable=True),
          sa.Column("content", sa.TEXT(), autoincrement=False, nullable=True),
          sa.Column(
              "timestamp", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
          ),
          sa.ForeignKeyConstraint(
              ["author_id"], ["user.id"], name="posts_author_id_fkey"
          ),
          sa.PrimaryKeyConstraint("id", name="posts_pkey"),
      )
      op.create_index("ix_posts_title", "posts", ["title"], unique=False)
      op.create_index("ix_posts_timestamp", "posts", ["timestamp"], unique=False)
      op.drop_table("collect")
      op.drop_index(op.f("ix_post_title"), table_name="post")
      op.drop_index(op.f("ix_post_timestamp"), table_name="post")
      op.drop_table("post")
      # ### end Alembic commands ###
  