首页 > 数据库 >django项目 数据migrate迁移成功 数据库未生成表 表现:Running migrations: No migrations to apply.

django项目 数据migrate迁移成功 数据库未生成表 表现:Running migrations: No migrations to apply.

时间:2022-09-27 19:44:41浏览次数:52  
标签:No migrate 数据库 migrations django apply

现象:python python manage.py migrate 后

提示:Running migrations:   No migrations to apply.

解决方法: 

找到相应数据库的数据库表django_migrations,之后有一个app字段为goods的名字:

删除这条记录,之后再重新执行数据迁移命令,前提是你已经生成了0001_initial.py这个文件。

最后,数据库表就会重新建立在数据库中。

注:我这里的goods是你们相应的出错的app的名字,哪个app出错,就删除哪个。

 

不成功的话左侧migrations文件下的0001_initial.py文件也要删除 

然后重新执行数据迁移。

(由于在django_migrations表中数据删除错误,我是重新建库新增的 以上的问题需验证 )

标签:No,migrate,数据库,migrations,django,apply
From: https://www.cnblogs.com/zs0621/p/16735713.html

相关文章

  • pg_ctl: no database directory specified and environment variable PGDATA unset , c
    centos7postgreSQLpg_ctl无效 在~/.bash_profile下配置了exportPGDATA=/var/lib/pgsql/11.0/data但是也没有效果。不过可以这样写转到/usr/pgsql/bin下后这......
  • pg_ctl: cannot be run as root
    症状使用pg_ctl管理数据库报错:当然如果设置了环境变量PGDATA=/d/pgsql/data启动pg_ctlstart启动报错[root@db1root~]#pg_ctlstartpg_ctl:cannotberunas......
  • ABC 244 C - Yamanote Line Game (交互题)
    https://atcoder.jp/contests/abc244/tasks/abc244_c题目大意:有两个人,分别叫做AB。给定一个数字,A先手,每个人可以从[1,2*n+1]这个范围内说出一个数字,说不出的人就输;我......
  • The engine "node" is incompatible with this module.
    root@test-OptiPlex-3050:/home/web/hflab#yarninstallyarninstallv1.22.19warningpackage-lock.jsonfound.Yourprojectcontainslockfilesgeneratedbytools......
  • lc19 removeNthFromEnd(node) 链表删除
    给你一个链表,删除链表的倒数第 n 个结点,并且返回链表的头结点。 示例1:输入:head=[1,2,3,4,5],n=2输出:[1,2,3,5]示例2:输入:head=[1],n=1输出:[]classSolu......
  • 【NOIP2017 提高组】列队
    [【NOIP2017提高组】列队](https://www.luogu.com.cn/problem/P3960)将每一行的第1到m-1个和第m列分离出来分析知这n+1个“区间”要维护弹出第k个和插入最后使用平衡树,......
  • 【NOIP2017 提高组]】宝藏
    【NOIP2017提高组】宝藏f[S][i]表示集合S的点构成的生成树,树高为i({i}为0)的最小花费转移:枚举S的子集S'为高度为i-1的树(S'可扩展出S):f[S][i]<-f[S'][i]+cost预处......
  • nodejs调用外部接口
    前言在日让的工作开发中,我们不仅仅要使用node来封装提供一些http接口,也会在node服务中调用一些第三方的HTTP接口,那么如何操作?request安装依赖npminstallrequest-S......
  • 第二章 kubeadm安装单master多node篇
    一.节点规划HostnameOuter-IPInner-IPk8s-master-00110.0.0.100172.16.1.113K8s-node-00110.0.0.101172.16.1.114K8s-node-00210.0.0.102172.16.1.......
  • hbuilderx 编译报错cannot find module ‘yallist’
    更新后的Hbuilder X报错error:cannotfindmodule‘yallist’解决方案打开huilberx-工具-插件安装  卸载重装,重启hbuilderx。重新编译即可......