diff --git a/server/szurubooru/db/user.py b/server/szurubooru/db/user.py index 0677734..663ddc8 100644 --- a/server/szurubooru/db/user.py +++ b/server/szurubooru/db/user.py @@ -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) diff --git a/server/szurubooru/migrations/versions/7032abdf6efd_make_login_time_nullable.py b/server/szurubooru/migrations/versions/7032abdf6efd_make_login_time_nullable.py deleted file mode 100644 index 9d6b4b9..0000000 --- a/server/szurubooru/migrations/versions/7032abdf6efd_make_login_time_nullable.py +++ /dev/null @@ -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) diff --git a/server/szurubooru/migrations/versions/89ca368219b6_change_user_access_rank.py b/server/szurubooru/migrations/versions/89ca368219b6_change_user_access_rank.py deleted file mode 100644 index c9252dc..0000000 --- a/server/szurubooru/migrations/versions/89ca368219b6_change_user_access_rank.py +++ /dev/null @@ -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)) diff --git a/server/szurubooru/migrations/versions/d186d2e9c2c9_add_unique_constraint_to_user_name.py b/server/szurubooru/migrations/versions/d186d2e9c2c9_add_unique_constraint_to_user_name.py deleted file mode 100644 index a04f019..0000000 --- a/server/szurubooru/migrations/versions/d186d2e9c2c9_add_unique_constraint_to_user_name.py +++ /dev/null @@ -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') diff --git a/server/szurubooru/migrations/versions/e5c1216a8503_create_user_table.py b/server/szurubooru/migrations/versions/e5c1216a8503_create_user_table.py index 0826448..7eea2ff 100644 --- a/server/szurubooru/migrations/versions/e5c1216a8503_create_user_table.py +++ b/server/szurubooru/migrations/versions/e5c1216a8503_create_user_table.py @@ -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')