This commit consolidates the migrations between 001 and 048 (inclusive) into a single database migration, to speed up the process of creating a new database. Change-Id: I2718165fc246ad499e6c3b164f557e9ab1580c03changes/70/510370/3
parent
acce431b30
commit
d0b595db25
@ -1,43 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""user update
|
||||
|
||||
Revision ID: 002
|
||||
Revises: 001
|
||||
Create Date: 2014-02-21 13:21:59.917098
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '002'
|
||||
down_revision = '001'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
op.drop_column('users', 'password')
|
||||
op.add_column('users', sa.Column('openid', sa.String(255)))
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
op.add_column('users', sa.Column('password', sa.UnicodeText))
|
||||
op.drop_column('users', 'openid')
|
@ -1,43 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""deletion states
|
||||
|
||||
Revision ID: 003
|
||||
Revises: 002
|
||||
Create Date: 2014-03-03 16:08:12.584302
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '003'
|
||||
down_revision = '002'
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.add_column('projects',
|
||||
Column('is_active', Boolean(), default=True))
|
||||
op.add_column('stories',
|
||||
Column('is_active', Boolean(), default=True))
|
||||
op.add_column('tasks',
|
||||
Column('is_active', Boolean(), default=True))
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
op.drop_column('projects', 'is_active')
|
||||
op.drop_column('stories', 'is_active')
|
||||
op.drop_column('tasks', 'is_active')
|
@ -1,44 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Expand project description
|
||||
|
||||
Revision ID: 004
|
||||
Revises: 003
|
||||
Create Date: 2014-03-05 17:03:12.978207
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '004'
|
||||
down_revision = '003'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
op.alter_column(
|
||||
'projects', 'description',
|
||||
type_=sa.UnicodeText)
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
op.alter_column(
|
||||
'projects', 'description',
|
||||
type_=sa.Unicode(100))
|
@ -1,73 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""empty message
|
||||
|
||||
Revision ID: 005
|
||||
Revises: 004
|
||||
Create Date: 2014-03-10 14:24:09.622503
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '005'
|
||||
down_revision = '004'
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.drop_column('projects', 'is_active')
|
||||
op.add_column('projects',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
op.drop_column('stories', 'is_active')
|
||||
op.add_column('stories',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
op.drop_column('tasks', 'is_active')
|
||||
op.add_column('tasks',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
op.drop_column('projects', 'is_active')
|
||||
op.add_column('projects',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
nullable=False))
|
||||
op.drop_column('stories', 'is_active')
|
||||
op.add_column('stories',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
nullable=False))
|
||||
op.drop_column('tasks', 'is_active')
|
||||
op.add_column('tasks',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
nullable=False))
|
@ -1,61 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Converts the user object to use full_name
|
||||
|
||||
Revision ID: 56bda170aa42
|
||||
Revises: 128470dcd02f
|
||||
Create Date: 2014-03-11 10:45:59.122062
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '006'
|
||||
down_revision = '005'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql.expression import column
|
||||
from sqlalchemy.sql.expression import table
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.add_column(
|
||||
'users',
|
||||
sa.Column('full_name', sa.Unicode(255), nullable=True)
|
||||
)
|
||||
|
||||
users = table(
|
||||
'users',
|
||||
column('first_name', sa.Unicode(30)),
|
||||
column('last_name', sa.Unicode(30)),
|
||||
column('full_name', sa.Unicode(255))
|
||||
)
|
||||
users.update().values(
|
||||
{'full_name': column('first_name') + op.inline_literal(' ') + column(
|
||||
'last_name')})
|
||||
|
||||
op.drop_column('users', 'first_name')
|
||||
op.drop_column('users', 'last_name')
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
op.add_column(
|
||||
'users',
|
||||
sa.Column('first_name', sa.Unicode(length=30), nullable=True)
|
||||
)
|
||||
op.add_column(
|
||||
'users',
|
||||
sa.Column('last_name', sa.Unicode(length=30), nullable=True)
|
||||
)
|
||||
op.drop_column('users', 'full_name')
|
@ -1,41 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""empty message
|
||||
|
||||
Revision ID: 007
|
||||
Revises: 006
|
||||
Create Date: 2014-04-18 14:55:09.622503
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '007'
|
||||
down_revision = '006'
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.add_column('comments',
|
||||
Column('is_active',
|
||||
Boolean(),
|
||||
default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
op.drop_column('comments', 'is_active')
|
@ -1,92 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove Branch, Milestone tables
|
||||
|
||||
Revision ID: 008
|
||||
Revises: 007
|
||||
Create Date: 2014-03-19 15:00:39.149963
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '008'
|
||||
down_revision = '007'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def _define_enums():
|
||||
branch_status = sa.Enum(
|
||||
'master', 'release', 'stable', 'unsupported',
|
||||
name='branch_status')
|
||||
|
||||
return {
|
||||
'branch_status': branch_status
|
||||
}
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.drop_constraint('tasks_ibfk_2',
|
||||
'tasks', type_='foreignkey')
|
||||
op.drop_column('tasks', 'milestone_id')
|
||||
op.drop_table('milestones')
|
||||
op.drop_table('branches')
|
||||
|
||||
# Need to explicitly delete enums during migrations for Postgres
|
||||
enums = _define_enums()
|
||||
for enum in enums.values():
|
||||
enum.drop(op.get_bind())
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
enums = _define_enums()
|
||||
|
||||
op.create_table(
|
||||
'branches',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('name', sa.String(length=50), nullable=True),
|
||||
sa.Column('status', enums['branch_status'], nullable=True),
|
||||
sa.Column('release_date', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name', name='uniq_branch_name'),
|
||||
mysql_engine=MYSQL_ENGINE,
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
op.create_table(
|
||||
'milestones',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('name', sa.String(length=50), nullable=True),
|
||||
sa.Column('branch_id', sa.Integer(), nullable=True),
|
||||
sa.Column('released', sa.Boolean(), nullable=True),
|
||||
sa.Column('undefined', sa.Boolean(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['branch_id'], ['branches.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name', name='uniq_milestone_name'),
|
||||
mysql_engine=MYSQL_ENGINE,
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
op.add_column('tasks', sa.Column('milestone_id',
|
||||
sa.Integer(),
|
||||
nullable=True))
|
||||
op.create_foreign_key('tasks_ibfk_2', 'tasks',
|
||||
'milestones', ['milestone_id'], ['id'])
|
@ -1,61 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove legacy priority column
|
||||
|
||||
Revision ID: 010
|
||||
Revises: 008
|
||||
Create Date: 2014-03-24 14:00:19.159763
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
# 009 is skipped on purpose due to a deployment sequencing bug
|
||||
revision = '010'
|
||||
down_revision = '008'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def _define_enums():
|
||||
storyboard_priority = sa.Enum(
|
||||
'Undefined', 'Low', 'Medium', 'High', 'Critical',
|
||||
name='priority')
|
||||
|
||||
return {
|
||||
'storyboard_priority': storyboard_priority
|
||||
}
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
op.drop_column('stories', 'priority')
|
||||
|
||||
# Need to explicitly delete enums during migrations for Postgres
|
||||
enums = _define_enums()
|
||||
for enum in enums.values():
|
||||
enum.drop(op.get_bind())
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
enums = _define_enums()
|
||||
for enum in enums.values():
|
||||
enum.create(op.get_bind())
|
||||
|
||||
op.add_column('stories', sa.Column('priority',
|
||||
enums['storyboard_priority'],
|
||||
nullable=True))
|
@ -1,74 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Add authorization models
|
||||
|
||||
Revision ID: 011
|
||||
Revises: 010
|
||||
Create Date: 2014-03-21 17:44:51.248232
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '011'
|
||||
down_revision = '010'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
op.create_table(
|
||||
'authorizationcodes',
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('code', sa.Unicode(100), nullable=False),
|
||||
sa.Column('state', sa.Unicode(100), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), default=True, server_default="1",
|
||||
nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_engine=MYSQL_ENGINE,
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
'bearertokens',
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('access_token', sa.Unicode(100), nullable=False),
|
||||
sa.Column('refresh_token', sa.Unicode(100), nullable=False),
|
||||
sa.Column('expires_in', sa.Integer(), nullable=False),
|
||||
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), default=True, server_default="1",
|
||||
nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_engine=MYSQL_ENGINE,
|
||||
mysql_charset=MYSQL_CHARSET
|
||||
)
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
op.drop_table('bearertokens')
|
||||
op.drop_table('authorizationcodes')
|
@ -1,63 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Update task states
|
||||
|
||||
Revision ID: 011
|
||||
Revises: 010
|
||||
Create Date: 2014-03-21 17:44:51.248232
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '012'
|
||||
down_revision = '011'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def _define_enums():
|
||||
task_status_old = sa.Enum(
|
||||
'Todo', 'In review', 'Landed',
|
||||
name='task_status')
|
||||
|
||||
task_status_new = sa.Enum(
|
||||
'todo', 'inprogress', 'invalid', 'review', 'merged',
|
||||
name='task_status')
|
||||
|
||||
return {
|
||||
'task_status_old': task_status_old,
|
||||
'task_status_new': task_status_new
|
||||
}
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
enums = _define_enums()
|
||||
|
||||
op.drop_column('tasks', 'status')
|
||||
op.add_column('tasks', sa.Column('status',
|
||||
enums['task_status_new'],
|
||||
nullable=True))
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
enums = _define_enums()
|
||||
|
||||
op.drop_column('tasks', 'status')
|
||||
op.add_column('tasks', sa.Column('status',
|
||||
enums['task_status_old'],
|
||||
nullable=True))
|
@ -1,102 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Split Access and Refresh tokens to separate tables.
|
||||
Remove is_active fields as unnecessary.
|
||||
Expired access tokens and authorization codes will be hard deleted.
|
||||
Refresh tokens should live forever.
|
||||
|
||||
Revision ID: 013
|
||||
Revises: 012
|
||||
Create Date: 2014-04-09 13:01:18.536369
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '013'
|
||||
down_revision = '012'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
MYSQL_ENGINE = 'InnoDB'
|
||||
MYSQL_CHARSET = 'utf8'
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
'accesstokens',
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('access_token', sa.Unicode(length=100), nullable=False),
|
||||
sa.Column('expires_in', sa.Integer(), nullable=False),
|
||||
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset=MYSQL_CHARSET,
|
||||
mysql_engine=MYSQL_ENGINE)
|
||||
|
||||
op.create_table(
|
||||
'refreshtokens',
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('refresh_token', sa.Unicode(length=100), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset=MYSQL_CHARSET,
|
||||
mysql_engine=MYSQL_ENGINE)
|
||||
|
||||
op.drop_table(u'bearertokens')
|
||||
op.drop_column(u'authorizationcodes', u'is_active')
|
||||
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
op.add_column(u'authorizationcodes',
|
||||
sa.Column('is_active', sa.Boolean(), default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
op.create_table(
|
||||
u'bearertokens',
|
||||
sa.Column(u'created_at', sa.DateTime(), nullable=True),
|
||||
sa.Column(u'updated_at', sa.DateTime(), nullable=True),
|
||||
sa.Column(u'id', sa.Integer(), nullable=False),
|
||||
sa.Column(u'user_id', sa.Integer(), nullable=False),
|
||||
sa.Column(u'access_token', sa.Unicode(length=100), nullable=False),
|
||||
sa.Column(u'refresh_token', sa.Unicode(length=100), nullable=False),
|
||||
sa.Column(u'expires_in', sa.Integer(), nullable=False),
|
||||
sa.Column(u'expires_at', sa.DateTime(), nullable=False),
|
||||
sa.Column(u'is_active', sa.Column('is_active', sa.Boolean(),
|
||||
default=True,
|
||||
server_default="1",
|
||||
nullable=False)),
|
||||
sa.ForeignKeyConstraint(['user_id'], [u'users.id'],
|
||||
name=u'bearertokens_ibfk_1'),
|
||||
sa.PrimaryKeyConstraint(u'id'),
|
||||
mysql_default_charset=MYSQL_CHARSET,
|
||||
mysql_engine=MYSQL_ENGINE)
|
||||
|
||||
op.drop_table('refreshtokens')
|
||||
op.drop_table('accesstokens')
|
||||
### end Alembic commands ###
|
@ -1,48 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove is_active from tasks.
|
||||
|
||||
Revision ID: 014
|
||||
Revises: 013
|
||||
Create Date: 2014-04-09 16:52:36.375926
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '014'
|
||||
down_revision = '013'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column(u'tasks', u'is_active')
|
||||
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
op.add_column(u'tasks',
|
||||
sa.Column('is_active', sa.Boolean(), default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
|
||||
### end Alembic commands ###
|
@ -1,48 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Remove is_active from stories.
|
||||
|
||||
Revision ID: 015
|
||||
Revises: 014
|
||||
Create Date: 2014-04-09 16:52:36.375926
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '015'
|
||||
down_revision = '014'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column(u'stories', u'is_active')
|
||||
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
op.add_column(u'stories',
|
||||
sa.Column('is_active', sa.Boolean(), default=True,
|
||||
server_default="1",
|
||||
nullable=False))
|
||||
|
||||
### end Alembic commands ###
|
@ -1,43 +0,0 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""We need to know who has created a task.
|
||||
|
||||
Revision ID: 016
|
||||
Revises: 015
|
||||
Create Date: 2014-04-15 17:16:07.368141
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '016'
|
||||
down_revision = '015'
|
||||
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||