DJANGO变动库的一次真实手动经历

时间:2023-03-09 02:12:17
DJANGO变动库的一次真实手动经历

在变更库时,由于对字段规划和约束性没考虑完全,需要手工操作数据库,以便可以重复执行。

有以下三点要注意。

1,先迎合错误输出,增删对应的表或字段。

2,必要时,修改migrations文件,以去除唯一性限制。

3,再必要时,清除django_migrations的最近操作表记录,重操作进行命令导入。

相关SQL语句:

drop table userauthor_appauthorgroup;
drop table userauthor_appauthorgroup_app_author_group;
drop table userauthor_appauthorgroup_app_author_group_user;
drop table userauthor_appauthorgroup_auth_action;
drop table userauthor_appauthorgroup_auth_role;
drop table userauthor_siteauthorgroup;

);
);
);
);
);

alter table deploy_deploypool  drop create_user_id;
alter table deploy_deploypool  drop deploy_workflow;
alter table deploy_deploypool  drop file_path;
alter table deploy_deploypool  drop jenkins_number;
alter table deploy_deploypool  drop jira_url;
alter table deploy_deploypool  drop name;
alter table deploy_deploypool  drop code_number;