From 0a54aedb9f310f10d8847e76171e13fc8aa5e099 Mon Sep 17 00:00:00 2001 From: s01249 Date: Fri, 13 Oct 2023 16:17:59 +0800 Subject: [PATCH] minor --- .gitignore | 1 + cmdb-api/migrations/versions/6a4df2623057_.py | 360 ------------------ 2 files changed, 1 insertion(+), 360 deletions(-) delete mode 100644 cmdb-api/migrations/versions/6a4df2623057_.py diff --git a/.gitignore b/.gitignore index 4811cef..b96e02b 100755 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ nosetests.xml .pytest_cache cmdb-api/test-output cmdb-api/api/uploaded_files +cmdb-api/migrations/versions # Translations *.mo diff --git a/cmdb-api/migrations/versions/6a4df2623057_.py b/cmdb-api/migrations/versions/6a4df2623057_.py deleted file mode 100644 index ab6b330..0000000 --- a/cmdb-api/migrations/versions/6a4df2623057_.py +++ /dev/null @@ -1,360 +0,0 @@ -"""empty message - -Revision ID: 6a4df2623057 -Revises: -Create Date: 2023-10-13 15:17:00.066858 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '6a4df2623057' -down_revision = None -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('common_data', - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=True), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('data_type', sa.VARCHAR(length=255), nullable=True), - sa.Column('data', sa.JSON(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_index(op.f('ix_common_data_deleted'), 'common_data', ['deleted'], unique=False) - op.create_table('common_notice_config', - sa.Column('deleted_at', sa.DateTime(), nullable=True), - sa.Column('deleted', sa.Boolean(), nullable=True), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('updated_at', sa.DateTime(), nullable=True), - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), - sa.Column('platform', sa.VARCHAR(length=255), nullable=False), - sa.Column('info', sa.JSON(), nullable=True), - sa.PrimaryKeyConstraint('id') - ) - op.create_index(op.f('ix_common_notice_config_deleted'), 'common_notice_config', ['deleted'], unique=False) - op.add_column('c_attributes', sa.Column('choice_other', sa.JSON(), nullable=True)) - op.drop_index('idx_c_attributes_uid', table_name='c_attributes') - op.create_index(op.f('ix_c_attributes_uid'), 'c_attributes', ['uid'], unique=False) - op.drop_index('ix_c_custom_dashboard_deleted', table_name='c_c_d') - op.create_index(op.f('ix_c_c_d_deleted'), 'c_c_d', ['deleted'], unique=False) - op.drop_index('ix_c_ci_type_triggers_deleted', table_name='c_c_t_t') - op.create_index(op.f('ix_c_c_t_t_deleted'), 'c_c_t_t', ['deleted'], unique=False) - op.drop_index('ix_c_ci_type_unique_constraints_deleted', table_name='c_c_t_u_c') - op.create_index(op.f('ix_c_c_t_u_c_deleted'), 'c_c_t_u_c', ['deleted'], unique=False) - op.drop_index('c_ci_types_uid', table_name='c_ci_types') - op.create_index(op.f('ix_c_ci_types_uid'), 'c_ci_types', ['uid'], unique=False) - op.alter_column('c_prv', 'uid', - existing_type=mysql.INTEGER(), - nullable=False) - op.drop_index('ix_c_preference_relation_views_deleted', table_name='c_prv') - op.drop_index('ix_c_preference_relation_views_name', table_name='c_prv') - op.create_index(op.f('ix_c_prv_deleted'), 'c_prv', ['deleted'], unique=False) - op.create_index(op.f('ix_c_prv_name'), 'c_prv', ['name'], unique=False) - op.create_index(op.f('ix_c_prv_uid'), 'c_prv', ['uid'], unique=False) - op.drop_index('ix_c_preference_show_attributes_deleted', table_name='c_psa') - op.drop_index('ix_c_preference_show_attributes_uid', table_name='c_psa') - op.create_index(op.f('ix_c_psa_deleted'), 'c_psa', ['deleted'], unique=False) - op.create_index(op.f('ix_c_psa_uid'), 'c_psa', ['uid'], unique=False) - op.drop_index('ix_c_preference_tree_views_deleted', table_name='c_ptv') - op.drop_index('ix_c_preference_tree_views_uid', table_name='c_ptv') - op.create_index(op.f('ix_c_ptv_deleted'), 'c_ptv', ['deleted'], unique=False) - op.create_index(op.f('ix_c_ptv_uid'), 'c_ptv', ['uid'], unique=False) - op.alter_column('common_department', 'department_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='部门名称', - existing_nullable=True) - op.alter_column('common_department', 'department_director_id', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='部门负责人ID', - existing_nullable=True) - op.alter_column('common_department', 'department_parent_id', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='上级部门ID', - existing_nullable=True) - op.alter_column('common_department', 'sort_value', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='排序值', - existing_nullable=True) - op.alter_column('common_department', 'acl_rid', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='ACL中rid', - existing_nullable=True) - op.alter_column('common_employee', 'email', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='邮箱', - existing_nullable=True) - op.alter_column('common_employee', 'username', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='用户名', - existing_nullable=True) - op.alter_column('common_employee', 'nickname', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='姓名', - existing_nullable=True) - op.alter_column('common_employee', 'sex', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=64), - comment=None, - existing_comment='性别', - existing_nullable=True) - op.alter_column('common_employee', 'position_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='职位名称', - existing_nullable=True) - op.alter_column('common_employee', 'mobile', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='电话号码', - existing_nullable=True) - op.alter_column('common_employee', 'avatar', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='头像', - existing_nullable=True) - op.alter_column('common_employee', 'direct_supervisor_id', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='直接上级ID', - existing_nullable=True) - op.alter_column('common_employee', 'department_id', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='部门ID', - existing_nullable=True) - op.alter_column('common_employee', 'acl_uid', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='ACL中uid', - existing_nullable=True) - op.alter_column('common_employee', 'acl_rid', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='ACL中rid', - existing_nullable=True) - op.alter_column('common_employee', 'acl_virtual_rid', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='ACL中虚拟角色rid', - existing_nullable=True) - op.alter_column('common_employee', 'last_login', - existing_type=mysql.TIMESTAMP(), - comment=None, - existing_comment='上次登录时间', - existing_nullable=True) - op.alter_column('common_employee', 'block', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='锁定状态', - existing_nullable=True) - op.alter_column('common_employee_info', 'info', - existing_type=mysql.JSON(), - comment=None, - existing_comment='员工信息', - existing_nullable=True) - op.alter_column('common_employee_info', 'employee_id', - existing_type=mysql.INTEGER(), - comment=None, - existing_comment='员工ID', - existing_nullable=True) - op.alter_column('common_internal_message', 'title', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='标题', - existing_nullable=True) - op.alter_column('common_internal_message', 'content', - existing_type=mysql.TEXT(charset='utf8mb3', collation='utf8mb3_unicode_ci'), - comment=None, - existing_comment='内容', - existing_nullable=True) - op.alter_column('common_internal_message', 'path', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment=None, - existing_comment='跳转路径', - existing_nullable=True) - op.alter_column('common_internal_message', 'is_read', - existing_type=mysql.TINYINT(display_width=1), - comment=None, - existing_comment='是否已读', - existing_nullable=True) - op.alter_column('common_internal_message', 'app_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=128), - comment=None, - existing_comment='应用名称', - existing_nullable=False) - op.alter_column('common_internal_message', 'category', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=128), - comment=None, - existing_comment='分类', - existing_nullable=False) - op.alter_column('common_internal_message', 'message_data', - existing_type=mysql.JSON(), - comment=None, - existing_comment='数据', - existing_nullable=True) - op.drop_column('users', 'apps') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('users', sa.Column('apps', mysql.JSON(), nullable=True)) - op.alter_column('common_internal_message', 'message_data', - existing_type=mysql.JSON(), - comment='数据', - existing_nullable=True) - op.alter_column('common_internal_message', 'category', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=128), - comment='分类', - existing_nullable=False) - op.alter_column('common_internal_message', 'app_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=128), - comment='应用名称', - existing_nullable=False) - op.alter_column('common_internal_message', 'is_read', - existing_type=mysql.TINYINT(display_width=1), - comment='是否已读', - existing_nullable=True) - op.alter_column('common_internal_message', 'path', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='跳转路径', - existing_nullable=True) - op.alter_column('common_internal_message', 'content', - existing_type=mysql.TEXT(charset='utf8mb3', collation='utf8mb3_unicode_ci'), - comment='内容', - existing_nullable=True) - op.alter_column('common_internal_message', 'title', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='标题', - existing_nullable=True) - op.alter_column('common_employee_info', 'employee_id', - existing_type=mysql.INTEGER(), - comment='员工ID', - existing_nullable=True) - op.alter_column('common_employee_info', 'info', - existing_type=mysql.JSON(), - comment='员工信息', - existing_nullable=True) - op.alter_column('common_employee', 'block', - existing_type=mysql.INTEGER(), - comment='锁定状态', - existing_nullable=True) - op.alter_column('common_employee', 'last_login', - existing_type=mysql.TIMESTAMP(), - comment='上次登录时间', - existing_nullable=True) - op.alter_column('common_employee', 'acl_virtual_rid', - existing_type=mysql.INTEGER(), - comment='ACL中虚拟角色rid', - existing_nullable=True) - op.alter_column('common_employee', 'acl_rid', - existing_type=mysql.INTEGER(), - comment='ACL中rid', - existing_nullable=True) - op.alter_column('common_employee', 'acl_uid', - existing_type=mysql.INTEGER(), - comment='ACL中uid', - existing_nullable=True) - op.alter_column('common_employee', 'department_id', - existing_type=mysql.INTEGER(), - comment='部门ID', - existing_nullable=True) - op.alter_column('common_employee', 'direct_supervisor_id', - existing_type=mysql.INTEGER(), - comment='直接上级ID', - existing_nullable=True) - op.alter_column('common_employee', 'avatar', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='头像', - existing_nullable=True) - op.alter_column('common_employee', 'mobile', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='电话号码', - existing_nullable=True) - op.alter_column('common_employee', 'position_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='职位名称', - existing_nullable=True) - op.alter_column('common_employee', 'sex', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=64), - comment='性别', - existing_nullable=True) - op.alter_column('common_employee', 'nickname', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='姓名', - existing_nullable=True) - op.alter_column('common_employee', 'username', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='用户名', - existing_nullable=True) - op.alter_column('common_employee', 'email', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='邮箱', - existing_nullable=True) - op.alter_column('common_department', 'acl_rid', - existing_type=mysql.INTEGER(), - comment='ACL中rid', - existing_nullable=True) - op.alter_column('common_department', 'sort_value', - existing_type=mysql.INTEGER(), - comment='排序值', - existing_nullable=True) - op.alter_column('common_department', 'department_parent_id', - existing_type=mysql.INTEGER(), - comment='上级部门ID', - existing_nullable=True) - op.alter_column('common_department', 'department_director_id', - existing_type=mysql.INTEGER(), - comment='部门负责人ID', - existing_nullable=True) - op.alter_column('common_department', 'department_name', - existing_type=mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), - comment='部门名称', - existing_nullable=True) - op.drop_index(op.f('ix_c_ptv_uid'), table_name='c_ptv') - op.drop_index(op.f('ix_c_ptv_deleted'), table_name='c_ptv') - op.create_index('ix_c_preference_tree_views_uid', 'c_ptv', ['uid'], unique=False) - op.create_index('ix_c_preference_tree_views_deleted', 'c_ptv', ['deleted'], unique=False) - op.drop_index(op.f('ix_c_psa_uid'), table_name='c_psa') - op.drop_index(op.f('ix_c_psa_deleted'), table_name='c_psa') - op.create_index('ix_c_preference_show_attributes_uid', 'c_psa', ['uid'], unique=False) - op.create_index('ix_c_preference_show_attributes_deleted', 'c_psa', ['deleted'], unique=False) - op.drop_index(op.f('ix_c_prv_uid'), table_name='c_prv') - op.drop_index(op.f('ix_c_prv_name'), table_name='c_prv') - op.drop_index(op.f('ix_c_prv_deleted'), table_name='c_prv') - op.create_index('ix_c_preference_relation_views_name', 'c_prv', ['name'], unique=False) - op.create_index('ix_c_preference_relation_views_deleted', 'c_prv', ['deleted'], unique=False) - op.alter_column('c_prv', 'uid', - existing_type=mysql.INTEGER(), - nullable=True) - op.drop_index(op.f('ix_c_ci_types_uid'), table_name='c_ci_types') - op.create_index('c_ci_types_uid', 'c_ci_types', ['uid'], unique=False) - op.drop_index(op.f('ix_c_c_t_u_c_deleted'), table_name='c_c_t_u_c') - op.create_index('ix_c_ci_type_unique_constraints_deleted', 'c_c_t_u_c', ['deleted'], unique=False) - op.drop_index(op.f('ix_c_c_t_t_deleted'), table_name='c_c_t_t') - op.create_index('ix_c_ci_type_triggers_deleted', 'c_c_t_t', ['deleted'], unique=False) - op.drop_index(op.f('ix_c_c_d_deleted'), table_name='c_c_d') - op.create_index('ix_c_custom_dashboard_deleted', 'c_c_d', ['deleted'], unique=False) - op.drop_index(op.f('ix_c_attributes_uid'), table_name='c_attributes') - op.create_index('idx_c_attributes_uid', 'c_attributes', ['uid'], unique=False) - op.drop_column('c_attributes', 'choice_other') - op.drop_index(op.f('ix_common_notice_config_deleted'), table_name='common_notice_config') - op.drop_table('common_notice_config') - op.drop_index(op.f('ix_common_data_deleted'), table_name='common_data') - op.drop_table('common_data') - # ### end Alembic commands ###