af906e964978_add_feedback_table.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. """Add feedback table
  2. Revision ID: af906e964978
  3. Revises: c29facfe716b
  4. Create Date: 2024-10-20 17:02:35.241684
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # Revision identifiers, used by Alembic.
  9. revision = "af906e964978"
  10. down_revision = "c29facfe716b"
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. # ### Create feedback table ###
  15. op.create_table(
  16. "feedback",
  17. sa.Column(
  18. "id", sa.Text(), primary_key=True
  19. ), # Unique identifier for each feedback (TEXT type)
  20. sa.Column(
  21. "user_id", sa.Text(), nullable=True
  22. ), # ID of the user providing the feedback (TEXT type)
  23. sa.Column(
  24. "version", sa.BigInteger(), default=0
  25. ), # Version of feedback (BIGINT type)
  26. sa.Column("type", sa.Text(), nullable=True), # Type of feedback (TEXT type)
  27. sa.Column("data", sa.JSON(), nullable=True), # Feedback data (JSON type)
  28. sa.Column(
  29. "meta", sa.JSON(), nullable=True
  30. ), # Metadata for feedback (JSON type)
  31. sa.Column(
  32. "snapshot", sa.JSON(), nullable=True
  33. ), # snapshot data for feedback (JSON type)
  34. sa.Column(
  35. "created_at", sa.BigInteger(), nullable=False
  36. ), # Feedback creation timestamp (BIGINT representing epoch)
  37. sa.Column(
  38. "updated_at", sa.BigInteger(), nullable=False
  39. ), # Feedback update timestamp (BIGINT representing epoch)
  40. )
  41. def downgrade():
  42. # ### Drop feedback table ###
  43. op.drop_table("feedback")