-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feature/task_scheduler' into dev…
…elop
- Loading branch information
Sander
committed
May 19, 2017
1 parent
f1b27ab
commit 773479f
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
gengine/app/alembic/versions/a90076b18837_tasks_and_shift.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"""tasks and shift | ||
Revision ID: a90076b18837 | ||
Revises: 8e65de1ed535 | ||
Create Date: 2017-05-19 11:18:09.260416 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'a90076b18837' | ||
down_revision = '8e65de1ed535' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
def upgrade(): | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('tasks', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('entry_name', sa.String(length=100), nullable=True), | ||
sa.Column('task_name', sa.String(length=100), nullable=False), | ||
sa.Column('config', sa.JSON(), nullable=True), | ||
sa.Column('cron', sa.String(length=100), nullable=True), | ||
sa.Column('is_removed', sa.Boolean(), nullable=False), | ||
sa.Column('is_auto_created', sa.Boolean(), nullable=False), | ||
sa.Column('is_user_modified', sa.Boolean(), nullable=False), | ||
sa.PrimaryKeyConstraint('id', name=op.f('pk_tasks')) | ||
) | ||
op.create_index(op.f('ix_tasks_entry_name'), 'tasks', ['entry_name'], unique=False) | ||
op.create_index(op.f('ix_tasks_is_auto_created'), 'tasks', ['is_auto_created'], unique=False) | ||
op.create_index(op.f('ix_tasks_is_removed'), 'tasks', ['is_removed'], unique=False) | ||
op.create_index(op.f('ix_tasks_is_user_modified'), 'tasks', ['is_user_modified'], unique=False) | ||
op.create_index(op.f('ix_tasks_task_name'), 'tasks', ['task_name'], unique=False) | ||
op.create_table('taskexecutions', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('task_id', sa.Integer(), nullable=False), | ||
sa.Column('planned_at', postgresql.TIMESTAMP(timezone=True), nullable=False), | ||
sa.Column('locked_at', postgresql.TIMESTAMP(timezone=True), nullable=True), | ||
sa.Column('finished_at', postgresql.TIMESTAMP(timezone=True), nullable=True), | ||
sa.Column('canceled_at', postgresql.TIMESTAMP(timezone=True), nullable=True), | ||
sa.Column('log', sa.String(), nullable=True), | ||
sa.Column('success', sa.Boolean(), nullable=True), | ||
sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], name=op.f('fk_taskexecutions_task_id_tasks'), ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id', name=op.f('pk_taskexecutions')) | ||
) | ||
op.create_index(op.f('ix_taskexecutions_canceled_at'), 'taskexecutions', ['canceled_at'], unique=False) | ||
op.create_index(op.f('ix_taskexecutions_finished_at'), 'taskexecutions', ['finished_at'], unique=False) | ||
op.create_index(op.f('ix_taskexecutions_locked_at'), 'taskexecutions', ['locked_at'], unique=False) | ||
op.create_index(op.f('ix_taskexecutions_planned_at'), 'taskexecutions', ['planned_at'], unique=False) | ||
op.create_index(op.f('ix_taskexecutions_success'), 'taskexecutions', ['success'], unique=False) | ||
op.create_index(op.f('ix_taskexecutions_task_id'), 'taskexecutions', ['task_id'], unique=False) | ||
op.add_column('achievements', sa.Column('evaluation_shift', sa.Integer(), nullable=True)) | ||
### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('achievements', 'evaluation_shift') | ||
op.drop_index(op.f('ix_taskexecutions_task_id'), table_name='taskexecutions') | ||
op.drop_index(op.f('ix_taskexecutions_success'), table_name='taskexecutions') | ||
op.drop_index(op.f('ix_taskexecutions_planned_at'), table_name='taskexecutions') | ||
op.drop_index(op.f('ix_taskexecutions_locked_at'), table_name='taskexecutions') | ||
op.drop_index(op.f('ix_taskexecutions_finished_at'), table_name='taskexecutions') | ||
op.drop_index(op.f('ix_taskexecutions_canceled_at'), table_name='taskexecutions') | ||
op.drop_table('taskexecutions') | ||
op.drop_index(op.f('ix_tasks_task_name'), table_name='tasks') | ||
op.drop_index(op.f('ix_tasks_is_user_modified'), table_name='tasks') | ||
op.drop_index(op.f('ix_tasks_is_removed'), table_name='tasks') | ||
op.drop_index(op.f('ix_tasks_is_auto_created'), table_name='tasks') | ||
op.drop_index(op.f('ix_tasks_entry_name'), table_name='tasks') | ||
op.drop_table('tasks') | ||
### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters