|
| 1 | +"""empty message |
| 2 | +
|
| 3 | +Revision ID: d9ce546dbcac |
| 4 | +Revises: 9ffa798c4399 |
| 5 | +Create Date: 2016-06-03 09:38:12.089267 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +# revision identifiers, used by Alembic. |
| 10 | +revision = 'd9ce546dbcac' |
| 11 | +down_revision = '9ffa798c4399' |
| 12 | + |
| 13 | +from alembic import op |
| 14 | +import sqlalchemy as sa |
| 15 | +from sqlalchemy.dialects import mysql |
| 16 | + |
| 17 | +def upgrade(): |
| 18 | + ### commands auto generated by Alembic - please adjust! ### |
| 19 | + op.create_table('results', |
| 20 | + sa.Column('id', mysql.INTEGER(unsigned=True), nullable=False), |
| 21 | + sa.Column('scan_id', mysql.INTEGER(display_width=11), nullable=True), |
| 22 | + sa.Column('rule_id', mysql.INTEGER(display_width=11), nullable=True), |
| 23 | + sa.Column('file', sa.String(length=512), nullable=True), |
| 24 | + sa.Column('line', mysql.INTEGER(display_width=11), nullable=True), |
| 25 | + sa.Column('code', sa.String(length=512), nullable=True), |
| 26 | + sa.Column('created_at', sa.DateTime(), nullable=True), |
| 27 | + sa.Column('updated_at', sa.DateTime(), nullable=True), |
| 28 | + sa.PrimaryKeyConstraint('id') |
| 29 | + ) |
| 30 | + op.create_table('tasks', |
| 31 | + sa.Column('id', mysql.INTEGER(unsigned=True), nullable=False), |
| 32 | + sa.Column('task_type', sa.SmallInteger(), nullable=False), |
| 33 | + sa.Column('filename', sa.String(length=255), nullable=True), |
| 34 | + sa.Column('url', sa.String(length=255), nullable=True), |
| 35 | + sa.Column('branch', sa.String(length=64), nullable=True), |
| 36 | + sa.Column('scan_way', sa.SmallInteger(), nullable=False), |
| 37 | + sa.Column('old_version', sa.String(length=40), nullable=True), |
| 38 | + sa.Column('new_version', sa.String(length=40), nullable=True), |
| 39 | + sa.Column('created_at', sa.DATETIME(), nullable=False), |
| 40 | + sa.Column('updated_at', sa.DATETIME(), nullable=False), |
| 41 | + sa.PrimaryKeyConstraint('id') |
| 42 | + ) |
| 43 | + op.drop_table('cobra_task_info') |
| 44 | + op.add_column(u'languages', sa.Column('extensions', sa.String(length=128), nullable=True)) |
| 45 | + op.drop_column(u'languages', 'suffix') |
| 46 | + op.add_column(u'projects', sa.Column('author', sa.String(length=50), nullable=True)) |
| 47 | + op.add_column(u'projects', sa.Column('last_scan', sa.DateTime(), nullable=True)) |
| 48 | + op.add_column(u'projects', sa.Column('remark', sa.String(length=50), nullable=True)) |
| 49 | + op.drop_column(u'projects', 'username') |
| 50 | + op.drop_column(u'projects', 'repo_type') |
| 51 | + op.drop_column(u'projects', 'password') |
| 52 | + op.drop_column(u'projects', 'scan_at') |
| 53 | + op.drop_column(u'projects', 'branch') |
| 54 | + op.add_column(u'whitelist', sa.Column('path', sa.String(length=512), nullable=True)) |
| 55 | + op.add_column(u'whitelist', sa.Column('status', mysql.TINYINT(), nullable=True)) |
| 56 | + op.drop_column(u'whitelist', 'file') |
| 57 | + ### end Alembic commands ### |
| 58 | + |
| 59 | + |
| 60 | +def downgrade(): |
| 61 | + ### commands auto generated by Alembic - please adjust! ### |
| 62 | + op.add_column(u'whitelist', sa.Column('file', mysql.VARCHAR(length=512), nullable=True)) |
| 63 | + op.drop_column(u'whitelist', 'status') |
| 64 | + op.drop_column(u'whitelist', 'path') |
| 65 | + op.add_column(u'projects', sa.Column('branch', mysql.VARCHAR(length=128), nullable=True)) |
| 66 | + op.add_column(u'projects', sa.Column('scan_at', mysql.DATETIME(), nullable=True)) |
| 67 | + op.add_column(u'projects', sa.Column('password', mysql.VARCHAR(length=128), nullable=True)) |
| 68 | + op.add_column(u'projects', sa.Column('repo_type', mysql.TINYINT(display_width=2), autoincrement=False, nullable=False)) |
| 69 | + op.add_column(u'projects', sa.Column('username', mysql.VARCHAR(length=128), nullable=True)) |
| 70 | + op.drop_column(u'projects', 'remark') |
| 71 | + op.drop_column(u'projects', 'last_scan') |
| 72 | + op.drop_column(u'projects', 'author') |
| 73 | + op.add_column(u'languages', sa.Column('suffix', mysql.VARCHAR(length=256), nullable=False)) |
| 74 | + op.drop_column(u'languages', 'extensions') |
| 75 | + op.create_table('cobra_task_info', |
| 76 | + sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), |
| 77 | + sa.Column('task_type', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), |
| 78 | + sa.Column('create_time', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), |
| 79 | + sa.Column('filename', mysql.VARCHAR(length=255), nullable=True), |
| 80 | + sa.Column('level', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False), |
| 81 | + sa.Column('new_version', mysql.VARCHAR(length=40), nullable=True), |
| 82 | + sa.Column('old_version', mysql.VARCHAR(length=40), nullable=True), |
| 83 | + sa.Column('password', mysql.VARCHAR(length=255), nullable=True), |
| 84 | + sa.Column('scan_type', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False), |
| 85 | + sa.Column('scan_way', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=False), |
| 86 | + sa.Column('url', mysql.VARCHAR(length=255), nullable=True), |
| 87 | + sa.Column('username', mysql.VARCHAR(length=255), nullable=True), |
| 88 | + sa.Column('branch', mysql.VARCHAR(length=64), nullable=True), |
| 89 | + sa.PrimaryKeyConstraint('id'), |
| 90 | + mysql_default_charset=u'utf8', |
| 91 | + mysql_engine=u'InnoDB' |
| 92 | + ) |
| 93 | + op.drop_table('tasks') |
| 94 | + op.drop_table('results') |
| 95 | + ### end Alembic commands ### |
0 commit comments