af906e964978_add_feedback_table.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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("type", sa.Text(), nullable=True), # Type of feedback (TEXT type)
  24. sa.Column("data", sa.JSON(), nullable=True), # Feedback data (JSON type)
  25. sa.Column(
  26. "meta", sa.JSON(), nullable=True
  27. ), # Metadata for feedback (JSON type)
  28. sa.Column(
  29. "created_at", sa.BigInteger(), nullable=False
  30. ), # Feedback creation timestamp (BIGINT representing epoch)
  31. sa.Column(
  32. "updated_at", sa.BigInteger(), nullable=False
  33. ), # Feedback update timestamp (BIGINT representing epoch)
  34. )
  35. def downgrade():
  36. # ### Drop feedback table ###
  37. op.drop_table("feedback")