83da20f4d7a_.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """empty message
  2. Revision ID: 83da20f4d7a
  3. Revises: None
  4. Create Date: 2015-04-17 11:10:22.330758
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '83da20f4d7a'
  8. down_revision = None
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ### commands auto generated by Alembic - please adjust! ###
  13. op.create_table('role',
  14. sa.Column('id', sa.Integer(), nullable=False),
  15. sa.Column('name', sa.String(length=255), nullable=False),
  16. sa.Column('description', sa.String(length=255), nullable=False),
  17. sa.PrimaryKeyConstraint('id'),
  18. sa.UniqueConstraint('name')
  19. )
  20. op.create_table('thingy',
  21. sa.Column('id', sa.Integer(), nullable=False),
  22. sa.Column('image', sa.String(length=255), nullable=False),
  23. sa.Column('image_storage_type', sa.String(length=255), nullable=False),
  24. sa.Column('image_storage_bucket_name', sa.String(length=255), nullable=False),
  25. sa.PrimaryKeyConstraint('id')
  26. )
  27. op.create_table('user',
  28. sa.Column('id', sa.Integer(), nullable=False),
  29. sa.Column('email', sa.String(length=255), nullable=False),
  30. sa.Column('password', sa.String(length=255), nullable=False),
  31. sa.PrimaryKeyConstraint('id'),
  32. sa.UniqueConstraint('email')
  33. )
  34. op.create_table('roles_users',
  35. sa.Column('user_id', sa.Integer(), nullable=True),
  36. sa.Column('role_id', sa.Integer(), nullable=True),
  37. sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
  38. sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
  39. )
  40. ### end Alembic commands ###
  41. def downgrade():
  42. ### commands auto generated by Alembic - please adjust! ###
  43. op.drop_table('roles_users')
  44. op.drop_table('user')
  45. op.drop_table('thingy')
  46. op.drop_table('role')
  47. ### end Alembic commands ###