Move all directories per theme
This commit is contained in:
45
core/admin/migrations/alembic.ini
Normal file
45
core/admin/migrations/alembic.ini
Normal file
@@ -0,0 +1,45 @@
|
||||
# A generic, single database configuration.
|
||||
|
||||
[alembic]
|
||||
# template used to generate migration files
|
||||
# file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
# set to 'true' to run the environment during
|
||||
# the 'revision' command, regardless of autogenerate
|
||||
# revision_environment = false
|
||||
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
||||
87
core/admin/migrations/env.py
Executable file
87
core/admin/migrations/env.py
Executable file
@@ -0,0 +1,87 @@
|
||||
from __future__ import with_statement
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
from logging.config import fileConfig
|
||||
import logging
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
fileConfig(config.config_file_name)
|
||||
logger = logging.getLogger('alembic.env')
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
from flask import current_app
|
||||
config.set_main_option('sqlalchemy.url',
|
||||
current_app.config.get('SQLALCHEMY_DATABASE_URI'))
|
||||
target_metadata = current_app.extensions['migrate'].db.metadata
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
|
||||
|
||||
def run_migrations_offline():
|
||||
"""Run migrations in 'offline' mode.
|
||||
|
||||
This configures the context with just a URL
|
||||
and not an Engine, though an Engine is acceptable
|
||||
here as well. By skipping the Engine creation
|
||||
we don't even need a DBAPI to be available.
|
||||
|
||||
Calls to context.execute() here emit the given string to the
|
||||
script output.
|
||||
|
||||
"""
|
||||
url = config.get_main_option("sqlalchemy.url")
|
||||
context.configure(url=url)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
def run_migrations_online():
|
||||
"""Run migrations in 'online' mode.
|
||||
|
||||
In this scenario we need to create an Engine
|
||||
and associate a connection with the context.
|
||||
|
||||
"""
|
||||
|
||||
# this callback is used to prevent an auto-migration from being generated
|
||||
# when there are no changes to the schema
|
||||
# reference: http://alembic.readthedocs.org/en/latest/cookbook.html
|
||||
def process_revision_directives(context, revision, directives):
|
||||
if getattr(config.cmd_opts, 'autogenerate', False):
|
||||
script = directives[0]
|
||||
if script.upgrade_ops.is_empty():
|
||||
directives[:] = []
|
||||
logger.info('No changes in schema detected.')
|
||||
|
||||
engine = engine_from_config(config.get_section(config.config_ini_section),
|
||||
prefix='sqlalchemy.',
|
||||
poolclass=pool.NullPool)
|
||||
|
||||
connection = engine.connect()
|
||||
context.configure(connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
process_revision_directives=process_revision_directives,
|
||||
**current_app.extensions['migrate'].configure_args)
|
||||
|
||||
try:
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
||||
22
core/admin/migrations/script.py.mako
Executable file
22
core/admin/migrations/script.py.mako
Executable file
@@ -0,0 +1,22 @@
|
||||
"""${message}
|
||||
|
||||
Revision ID: ${up_revision}
|
||||
Revises: ${down_revision}
|
||||
Create Date: ${create_date}
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = ${repr(up_revision)}
|
||||
down_revision = ${repr(down_revision)}
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
${imports if imports else ""}
|
||||
|
||||
def upgrade():
|
||||
${upgrades if upgrades else "pass"}
|
||||
|
||||
|
||||
def downgrade():
|
||||
${downgrades if downgrades else "pass"}
|
||||
47
core/admin/migrations/versions/12e9a4f6ed73_.py
Normal file
47
core/admin/migrations/versions/12e9a4f6ed73_.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""Set the spam threshold as an integer
|
||||
|
||||
Revision ID: 12e9a4f6ed73
|
||||
Revises: 27ae2f102682
|
||||
Create Date: 2016-11-08 20:22:54.169833
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '12e9a4f6ed73'
|
||||
down_revision = '27ae2f102682'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
user_table = sa.Table(
|
||||
'user',
|
||||
sa.MetaData(),
|
||||
sa.Column('email', sa.String(255), primary_key=True),
|
||||
sa.Column('spam_threshold', sa.Numeric())
|
||||
)
|
||||
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
# Make sure that every value is already an Integer
|
||||
for user in connection.execute(user_table.select()):
|
||||
connection.execute(
|
||||
user_table.update().where(
|
||||
user_table.c.email == user.email
|
||||
).values(
|
||||
spam_threshold=int(user.spam_threshold)
|
||||
)
|
||||
)
|
||||
# Migrate the table
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column(
|
||||
'spam_threshold', existing_type=sa.Numeric(), type_=sa.Integer())
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Migrate the table
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column(
|
||||
'spam_threshold', existing_type=sa.Integer(), type_=sa.Numeric())
|
||||
23
core/admin/migrations/versions/2335c80a6bc3_.py
Normal file
23
core/admin/migrations/versions/2335c80a6bc3_.py
Normal file
@@ -0,0 +1,23 @@
|
||||
""" Add a maximum quota per domain
|
||||
|
||||
Revision ID: 2335c80a6bc3
|
||||
Revises: 12e9a4f6ed73
|
||||
Create Date: 2016-12-04 12:57:37.576622
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2335c80a6bc3'
|
||||
down_revision = '12e9a4f6ed73'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('domain', sa.Column('max_quota_bytes', sa.Integer(), nullable=False, server_default='0'))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('domain') as batch:
|
||||
batch.drop_column('max_quota_bytes')
|
||||
53
core/admin/migrations/versions/27ae2f102682_.py
Normal file
53
core/admin/migrations/versions/27ae2f102682_.py
Normal file
@@ -0,0 +1,53 @@
|
||||
"""spam_threshold in percent
|
||||
|
||||
Revision ID: 27ae2f102682
|
||||
Revises: dc8c25cf5b98
|
||||
Create Date: 2016-09-30 08:06:15.025190
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '27ae2f102682'
|
||||
down_revision = 'dc8c25cf5b98'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
user_table = sa.Table(
|
||||
'user',
|
||||
sa.MetaData(),
|
||||
sa.Column('email', sa.String(255), primary_key=True),
|
||||
sa.Column('spam_threshold', sa.Numeric())
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
# spam_threshold is a X/15 based value, we're converting it to percent.
|
||||
for user in connection.execute(user_table.select()):
|
||||
connection.execute(
|
||||
user_table.update().where(
|
||||
user_table.c.email == user.email
|
||||
).values(
|
||||
spam_threshold=int(100. * float(user.spam_threshold or 0.) / 15.)
|
||||
)
|
||||
)
|
||||
# set default to 80%
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column('spam_threshold', default=80.)
|
||||
|
||||
def downgrade():
|
||||
connection = op.get_bind()
|
||||
# spam_threshold is a X/15 based value, we're converting it from percent.
|
||||
for user in connection.execute(user_table.select()):
|
||||
connection.execute(
|
||||
user_table.update().where(
|
||||
user_table.c.email == user.email
|
||||
).values(
|
||||
spam_threshold=int(15. * float(user.spam_threshold or 0.) / 100.)
|
||||
)
|
||||
)
|
||||
# set default to 10/15
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column('spam_threshold', default=10.)
|
||||
38
core/admin/migrations/versions/3f6994568962_.py
Normal file
38
core/admin/migrations/versions/3f6994568962_.py
Normal file
@@ -0,0 +1,38 @@
|
||||
""" Add keep as an option in fetches
|
||||
|
||||
Revision ID: 3f6994568962
|
||||
Revises: 2335c80a6bc3
|
||||
Create Date: 2017-02-02 22:31:00.719703
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3f6994568962'
|
||||
down_revision = '2335c80a6bc3'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from mailu import app
|
||||
|
||||
|
||||
fetch_table = sa.Table(
|
||||
'fetch',
|
||||
sa.MetaData(),
|
||||
sa.Column('keep', sa.Boolean())
|
||||
)
|
||||
|
||||
|
||||
def upgrade():
|
||||
connection = op.get_bind()
|
||||
op.add_column('fetch', sa.Column('keep', sa.Boolean(), nullable=False, server_default=sa.sql.expression.false()))
|
||||
# also apply the current config value if set
|
||||
if app.config.get("FETCHMAIL_KEEP", "False") == "True":
|
||||
connection.execute(
|
||||
fetch_table.update().values(keep=True)
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('fetch') as batch:
|
||||
batch.drop_column('keep')
|
||||
24
core/admin/migrations/versions/73e56bad5ec5_.py
Normal file
24
core/admin/migrations/versions/73e56bad5ec5_.py
Normal file
@@ -0,0 +1,24 @@
|
||||
""" Add the ability to keep forwarded messages
|
||||
|
||||
Revision ID: 73e56bad5ec5
|
||||
Revises: 3f6994568962
|
||||
Create Date: 2017-09-03 15:36:07.821002
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '73e56bad5ec5'
|
||||
down_revision = '3f6994568962'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.add_column(sa.Column('forward_keep', sa.Boolean(), nullable=False, server_default=sa.sql.expression.true()))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.drop_column('forward_keep')
|
||||
32
core/admin/migrations/versions/9400a032eb1a_.py
Normal file
32
core/admin/migrations/versions/9400a032eb1a_.py
Normal file
@@ -0,0 +1,32 @@
|
||||
""" Add authentication tokens
|
||||
|
||||
Revision ID: 9400a032eb1a
|
||||
Revises: 9c28df23f77e
|
||||
Create Date: 2017-10-29 14:31:58.032989
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9400a032eb1a'
|
||||
down_revision = '9c28df23f77e'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('token',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_email', sa.String(length=255), nullable=False),
|
||||
sa.Column('password', sa.String(length=255), nullable=False),
|
||||
sa.Column('ip', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_email'], ['user.email'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('token')
|
||||
28
core/admin/migrations/versions/9c28df23f77e_.py
Normal file
28
core/admin/migrations/versions/9c28df23f77e_.py
Normal file
@@ -0,0 +1,28 @@
|
||||
""" Set the nocase collation on the user and alias tables
|
||||
|
||||
Revision ID: 9c28df23f77e
|
||||
Revises: c162ac88012a
|
||||
Create Date: 2017-10-29 13:28:29.155754
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '9c28df23f77e'
|
||||
down_revision = 'c162ac88012a'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE"))
|
||||
with op.batch_alter_table('alias') as batch:
|
||||
batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE"))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.alter_column('email', type_=sa.String(length=255))
|
||||
with op.batch_alter_table('alias') as batch:
|
||||
batch.alter_column('email', type_=sa.String(length=255))
|
||||
25
core/admin/migrations/versions/a4accda8a8c7_.py
Normal file
25
core/admin/migrations/versions/a4accda8a8c7_.py
Normal file
@@ -0,0 +1,25 @@
|
||||
""" Update the spam threshold default value
|
||||
|
||||
Revision ID: a4accda8a8c7
|
||||
Revises: c5696b48442d
|
||||
Create Date: 2016-08-18 20:34:19.624603
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a4accda8a8c7'
|
||||
down_revision = 'c5696b48442d'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('user') as batch:
|
||||
batch.drop_column('spam_threshold')
|
||||
batch.add_column(sa.Column('spam_threshold', sa.Numeric(),
|
||||
default=10.0))
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
29
core/admin/migrations/versions/c162ac88012a_.py
Normal file
29
core/admin/migrations/versions/c162ac88012a_.py
Normal file
@@ -0,0 +1,29 @@
|
||||
""" Add relayed domains
|
||||
|
||||
Revision ID: c162ac88012a
|
||||
Revises: c9a0b4e653cf
|
||||
Create Date: 2017-09-10 20:21:10.011969
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c162ac88012a'
|
||||
down_revision = 'c9a0b4e653cf'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('relay',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('name', sa.String(length=80), nullable=False),
|
||||
sa.Column('smtp', sa.String(length=80), nullable=True),
|
||||
sa.PrimaryKeyConstraint('name')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('relay')
|
||||
22
core/admin/migrations/versions/c5696b48442d_.py
Normal file
22
core/admin/migrations/versions/c5696b48442d_.py
Normal file
@@ -0,0 +1,22 @@
|
||||
""" Add wildcard aliases
|
||||
|
||||
Revision ID: c5696b48442d
|
||||
Revises: ff0417f4318f
|
||||
Create Date: 2016-08-15 22:19:50.128960
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c5696b48442d'
|
||||
down_revision = 'ff0417f4318f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('alias', sa.Column('wildcard', sa.Boolean(), nullable=False, server_default=sa.sql.expression.false()))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('alias', 'wildcard')
|
||||
30
core/admin/migrations/versions/c9a0b4e653cf_.py
Normal file
30
core/admin/migrations/versions/c9a0b4e653cf_.py
Normal file
@@ -0,0 +1,30 @@
|
||||
""" Add alternative domains
|
||||
|
||||
Revision ID: c9a0b4e653cf
|
||||
Revises: 73e56bad5ec5
|
||||
Create Date: 2017-09-03 18:23:36.356527
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c9a0b4e653cf'
|
||||
down_revision = '73e56bad5ec5'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('alternative',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('name', sa.String(length=80), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=80), nullable=True),
|
||||
sa.ForeignKeyConstraint(['domain_name'], ['domain.name'], ),
|
||||
sa.PrimaryKeyConstraint('name')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('alternative')
|
||||
25
core/admin/migrations/versions/dc8c25cf5b98_.py
Normal file
25
core/admin/migrations/versions/dc8c25cf5b98_.py
Normal file
@@ -0,0 +1,25 @@
|
||||
""" Add metadata related to fetches
|
||||
|
||||
Revision ID: dc8c25cf5b98
|
||||
Revises: a4accda8a8c7
|
||||
Create Date: 2016-09-10 12:41:01.161357
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dc8c25cf5b98'
|
||||
down_revision = 'a4accda8a8c7'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('fetch', sa.Column('error', sa.String(length=1023), nullable=True))
|
||||
op.add_column('fetch', sa.Column('last_check', sa.DateTime(), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('fetch') as batch:
|
||||
batch.drop_column('last_check')
|
||||
batch.drop_column('error')
|
||||
89
core/admin/migrations/versions/ff0417f4318f_.py
Normal file
89
core/admin/migrations/versions/ff0417f4318f_.py
Normal file
@@ -0,0 +1,89 @@
|
||||
""" Initial schema
|
||||
|
||||
Revision ID: ff0417f4318f
|
||||
Revises: None
|
||||
Create Date: 2016-06-25 13:07:11.132070
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ff0417f4318f'
|
||||
down_revision = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table('domain',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('name', sa.String(length=80), nullable=False),
|
||||
sa.Column('max_users', sa.Integer(), nullable=False),
|
||||
sa.Column('max_aliases', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('name')
|
||||
)
|
||||
op.create_table('alias',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('localpart', sa.String(length=80), nullable=False),
|
||||
sa.Column('destination', sa.String(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=80), nullable=False),
|
||||
sa.Column('email', sa.String(length=255), nullable=False),
|
||||
sa.ForeignKeyConstraint(['domain_name'], ['domain.name'], ),
|
||||
sa.PrimaryKeyConstraint('email')
|
||||
)
|
||||
op.create_table('user',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('localpart', sa.String(length=80), nullable=False),
|
||||
sa.Column('password', sa.String(length=255), nullable=False),
|
||||
sa.Column('quota_bytes', sa.Integer(), nullable=False),
|
||||
sa.Column('global_admin', sa.Boolean(), nullable=False),
|
||||
sa.Column('enable_imap', sa.Boolean(), nullable=False),
|
||||
sa.Column('enable_pop', sa.Boolean(), nullable=False),
|
||||
sa.Column('forward_enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('forward_destination', sa.String(length=255), nullable=True),
|
||||
sa.Column('reply_enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('reply_subject', sa.String(length=255), nullable=True),
|
||||
sa.Column('reply_body', sa.Text(), nullable=True),
|
||||
sa.Column('displayed_name', sa.String(length=160), nullable=False),
|
||||
sa.Column('spam_enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('spam_threshold', sa.Numeric(), nullable=False),
|
||||
sa.Column('domain_name', sa.String(length=80), nullable=False),
|
||||
sa.Column('email', sa.String(length=255), nullable=False),
|
||||
sa.ForeignKeyConstraint(['domain_name'], ['domain.name'], ),
|
||||
sa.PrimaryKeyConstraint('email')
|
||||
)
|
||||
op.create_table('fetch',
|
||||
sa.Column('created_at', sa.Date(), nullable=False),
|
||||
sa.Column('updated_at', sa.Date(), nullable=True),
|
||||
sa.Column('comment', sa.String(length=255), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_email', sa.String(length=255), nullable=False),
|
||||
sa.Column('protocol', sa.Enum('imap', 'pop3'), nullable=False),
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('port', sa.Integer(), nullable=False),
|
||||
sa.Column('tls', sa.Boolean(), nullable=False),
|
||||
sa.Column('username', sa.String(length=255), nullable=False),
|
||||
sa.Column('password', sa.String(length=255), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_email'], ['user.email'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('manager',
|
||||
sa.Column('domain_name', sa.String(length=80), nullable=True),
|
||||
sa.Column('user_email', sa.String(length=255), nullable=True),
|
||||
sa.ForeignKeyConstraint(['domain_name'], ['domain.name'], ),
|
||||
sa.ForeignKeyConstraint(['user_email'], ['user.email'], )
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('manager')
|
||||
op.drop_table('fetch')
|
||||
op.drop_table('user')
|
||||
op.drop_table('alias')
|
||||
op.drop_table('domain')
|
||||
Reference in New Issue
Block a user