9cd4c96d7f08_initial_migration.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. """Initial migration
  2. Revision ID: 9cd4c96d7f08
  3. Revises:
  4. Create Date: 2026-01-21 18:15:33.211017
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = '9cd4c96d7f08'
  10. down_revision = None
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. # ### commands auto generated by Alembic - please adjust! ###
  15. op.create_table('carousel',
  16. sa.Column('id', sa.Integer(), nullable=False),
  17. sa.Column('image_url', sa.String(length=256), nullable=False),
  18. sa.Column('link', sa.String(length=256), nullable=True),
  19. sa.Column('location', sa.String(length=20), nullable=False),
  20. sa.Column('sort_order', sa.Integer(), nullable=True),
  21. sa.Column('created_at', sa.DateTime(), nullable=True),
  22. sa.PrimaryKeyConstraint('id')
  23. )
  24. op.create_table('case_category',
  25. sa.Column('id', sa.Integer(), nullable=False),
  26. sa.Column('name', sa.String(length=64), nullable=False),
  27. sa.Column('section', sa.String(length=20), nullable=False),
  28. sa.Column('created_at', sa.DateTime(), nullable=True),
  29. sa.PrimaryKeyConstraint('id')
  30. )
  31. op.create_table('news',
  32. sa.Column('id', sa.Integer(), nullable=False),
  33. sa.Column('title', sa.String(length=128), nullable=False),
  34. sa.Column('content', sa.Text(), nullable=True),
  35. sa.Column('image_url', sa.String(length=256), nullable=True),
  36. sa.Column('author', sa.String(length=64), nullable=True),
  37. sa.Column('publish_time', sa.DateTime(), nullable=True),
  38. sa.Column('created_at', sa.DateTime(), nullable=True),
  39. sa.PrimaryKeyConstraint('id')
  40. )
  41. op.create_table('partner',
  42. sa.Column('id', sa.Integer(), nullable=False),
  43. sa.Column('name', sa.String(length=128), nullable=False),
  44. sa.Column('image_url', sa.String(length=256), nullable=True),
  45. sa.Column('link', sa.String(length=256), nullable=True),
  46. sa.Column('created_at', sa.DateTime(), nullable=True),
  47. sa.PrimaryKeyConstraint('id')
  48. )
  49. op.create_table('strategic_cooperation',
  50. sa.Column('id', sa.Integer(), nullable=False),
  51. sa.Column('name', sa.String(length=128), nullable=False),
  52. sa.Column('image_url', sa.String(length=256), nullable=True),
  53. sa.Column('link', sa.String(length=256), nullable=True),
  54. sa.Column('created_at', sa.DateTime(), nullable=True),
  55. sa.PrimaryKeyConstraint('id')
  56. )
  57. op.create_table('user',
  58. sa.Column('id', sa.Integer(), nullable=False),
  59. sa.Column('username', sa.String(length=64), nullable=False),
  60. sa.Column('password_hash', sa.String(length=256), nullable=True),
  61. sa.Column('created_at', sa.DateTime(), nullable=True),
  62. sa.PrimaryKeyConstraint('id'),
  63. sa.UniqueConstraint('username')
  64. )
  65. op.create_table('cooperation_case',
  66. sa.Column('id', sa.Integer(), nullable=False),
  67. sa.Column('title', sa.String(length=128), nullable=False),
  68. sa.Column('image_url', sa.String(length=256), nullable=True),
  69. sa.Column('description', sa.Text(), nullable=True),
  70. sa.Column('section', sa.String(length=20), nullable=False),
  71. sa.Column('category_id', sa.Integer(), nullable=True),
  72. sa.Column('created_at', sa.DateTime(), nullable=True),
  73. sa.ForeignKeyConstraint(['category_id'], ['case_category.id'], ),
  74. sa.PrimaryKeyConstraint('id')
  75. )
  76. # ### end Alembic commands ###
  77. def downgrade():
  78. # ### commands auto generated by Alembic - please adjust! ###
  79. op.drop_table('cooperation_case')
  80. op.drop_table('user')
  81. op.drop_table('strategic_cooperation')
  82. op.drop_table('partner')
  83. op.drop_table('news')
  84. op.drop_table('case_category')
  85. op.drop_table('carousel')
  86. # ### end Alembic commands ###