1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00

Merge pull request #838 from hoellen/schema-maxUserQuota-1

Change quota columns type to BigInteger
This commit is contained in:
hoellen 2019-01-16 12:07:50 +01:00 committed by GitHub
commit 79c4edcaf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 3 deletions

View File

@ -131,7 +131,7 @@ class Domain(Base):
backref=db.backref('manager_of'), lazy='dynamic')
max_users = db.Column(db.Integer, nullable=False, default=-1)
max_aliases = db.Column(db.Integer, nullable=False, default=-1)
max_quota_bytes = db.Column(db.Integer(), nullable=False, default=0)
max_quota_bytes = db.Column(db.BigInteger(), nullable=False, default=0)
signup_enabled = db.Column(db.Boolean(), nullable=False, default=False)
@property
@ -307,8 +307,8 @@ class User(Base, Email):
domain = db.relationship(Domain,
backref=db.backref('users', cascade='all, delete-orphan'))
password = db.Column(db.String(255), nullable=False)
quota_bytes = db.Column(db.Integer(), nullable=False, default=10**9)
quota_bytes_used = db.Column(db.Integer(), nullable=False, default=0)
quota_bytes = db.Column(db.BigInteger(), nullable=False, default=10**9)
quota_bytes_used = db.Column(db.BigInteger(), nullable=False, default=0)
global_admin = db.Column(db.Boolean(), nullable=False, default=False)
enabled = db.Column(db.Boolean(), nullable=False, default=True)

View File

@ -0,0 +1,30 @@
"""change quota type to bigint
Revision ID: 3b7eee912b41
Revises: fc099bd15cbe
Create Date: 2019-01-15 08:51:05.346257
"""
# revision identifiers, used by Alembic.
revision = '3b7eee912b41'
down_revision = 'fc099bd15cbe'
from alembic import op
import sqlalchemy as sa
def upgrade():
with op.batch_alter_table('domain') as batch:
batch.alter_column('max_quota_bytes', type_=sa.BigInteger(), nullable=False, server_default='0')
with op.batch_alter_table('user') as batch:
batch.alter_column('quota_bytes', type_=sa.BigInteger(), nullable=False)
batch.alter_column('quota_bytes_used', type_=sa.BigInteger(), nullable=False, server_default='0')
def downgrade():
with op.batch_alter_table('domain') as batch:
batch.alter_column('max_quota_bytes', type_=sa.Integer(), nullable=False, server_default='0')
with op.batch_alter_table('user') as batch:
batch.alter_column('quota_bytes', type_=sa.Integer(), nullable=False)
batch.alter_column('quota_bytes_used', type_=sa.Integer(), nullable=False, server_default='0')