server/db: squash db migrations, fix typo
This commit is contained in:
parent
e12492bd4d
commit
05e4a1b977
5 changed files with 8 additions and 74 deletions
|
@ -10,9 +10,9 @@ class User(Base):
|
|||
user_id = sa.Column('id', sa.Integer, primary_key=True)
|
||||
name = sa.Column('name', sa.String(50), nullable=False, unique=True)
|
||||
password_hash = sa.Column('password_hash', sa.String(64), nullable=False)
|
||||
password_salt = sa.Column('pasword_salt', sa.String(32))
|
||||
password_salt = sa.Column('password_salt', sa.String(32))
|
||||
email = sa.Column('email', sa.String(200), nullable=True)
|
||||
rank = sa.Column('access_rank', sa.String(32), nullable=False)
|
||||
rank = sa.Column('rank', sa.String(32), nullable=False)
|
||||
creation_time = sa.Column('creation_time', sa.DateTime, nullable=False)
|
||||
last_login_time = sa.Column('last_login_time', sa.DateTime)
|
||||
avatar_style = sa.Column('avatar_style', sa.Integer, nullable=False)
|
||||
avatar_style = sa.Column('avatar_style', sa.String(32), nullable=False)
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
'''
|
||||
Make login time nullable
|
||||
|
||||
Revision ID: 7032abdf6efd
|
||||
Created at: 2016-03-28 13:35:59.147167
|
||||
'''
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '7032abdf6efd'
|
||||
down_revision = '89ca368219b6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
op.alter_column(
|
||||
'user', 'last_login_time',
|
||||
existing_type=postgresql.TIMESTAMP(), nullable=True)
|
||||
|
||||
def downgrade():
|
||||
op.alter_column(
|
||||
'user', 'last_login_time',
|
||||
existing_type=postgresql.TIMESTAMP(), nullable=False)
|
|
@ -1,22 +0,0 @@
|
|||
'''
|
||||
Changes access rank column to string
|
||||
|
||||
Revision ID: 89ca368219b6
|
||||
Created at: 2016-03-28 10:35:40.285485
|
||||
'''
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = '89ca368219b6'
|
||||
down_revision = 'd186d2e9c2c9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
op.drop_column('user', 'access_rank')
|
||||
op.add_column('user', sa.Column('access_rank', sa.String(length=32), nullable=False))
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('user', 'access_rank')
|
||||
op.add_column('user', sa.Column('access_rank', sa.INTEGER(), autoincrement=False, nullable=False))
|
|
@ -1,20 +0,0 @@
|
|||
'''
|
||||
Add unique constraint to the user name
|
||||
|
||||
Revision ID: d186d2e9c2c9
|
||||
Created at: 2016-03-28 10:21:30.440333
|
||||
'''
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision = 'd186d2e9c2c9'
|
||||
down_revision = 'e5c1216a8503'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
op.create_unique_constraint('uq_user_name', 'user', ['name'])
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('uq_user_name', 'user', type_='unique')
|
|
@ -19,13 +19,14 @@ def upgrade():
|
|||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=50), nullable=False),
|
||||
sa.Column('password_hash', sa.String(length=64), nullable=False),
|
||||
sa.Column('pasword_salt', sa.String(length=32), nullable=True),
|
||||
sa.Column('password_salt', sa.String(length=32), nullable=True),
|
||||
sa.Column('email', sa.String(length=200), nullable=True),
|
||||
sa.Column('access_rank', sa.Integer(), nullable=False),
|
||||
sa.Column('rank', sa.String(length=32), nullable=False),
|
||||
sa.Column('creation_time', sa.DateTime(), nullable=False),
|
||||
sa.Column('last_login_time', sa.DateTime(), nullable=False),
|
||||
sa.Column('avatar_style', sa.Integer(), nullable=False),
|
||||
sa.Column('last_login_time', sa.DateTime()),
|
||||
sa.Column('avatar_style', sa.String(length=32), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'))
|
||||
op.create_unique_constraint('uq_user_name', 'user', ['name'])
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('user')
|
||||
|
|
Loading…
Reference in a new issue