当辩解时没有创建表格,“ python3管理迁移”。

发布于 2025-01-27 20:27:25 字数 1385 浏览 2 评论 0原文

Python版本:3.6.4
Django版本:3.1.7
db:sqlite3
my_app:机器人
my_models:check_monitor_task,action_manager,Question_answers_task

step1:模型
步骤2:Python3经理Makemigrations

“机器人”的迁移:
机器人/迁移/0001_Initial.py
- 创建模型Action_manager
- 创建模型check_monitor_task
- 创建模型问题_answers_task

step3:Python3 Manager迁移

执行的操作:
应用所有迁移:管理员,auth,contenttypes,机器人,会话
运行迁移:
应用Robot.0001_Initial ... OK

步骤4:确认表
django_migrations中有记录

sqlite>选择 *从django_migrations desc desc limit 3;
中选择 * id | app |名称|应用
25 |机器人| 0001_Initial | 2022-05-11 17:33:16.780900
18 |会议| 0001_Initial | 2022-05-10 21:30:28.049031
17 | auth | 0012_alter_user_first_name_max_length | 2022-05-10 21:30:27.985724

,但没有桌子显示:

python3 manage.py dbshel​​l
SQLite版本3.21.0 2017-10-24 18:55:49
输入“ .help”以获取提示。
sqlite> .tables
auth_group auth_user_user_permissions
auth_group_permissions django_admin_log
auth_permission django_content_type
auth_user django_migrations
auth_user_groups django_session
sqlite>

我试图删除1.移民文件,2.Pycache,3.sqlite3.db,但每次都这样工作。
请告诉我的原因以及如何创建表。谢谢。

python version: 3.6.4
django version: 3.1.7
db: sqlite3
my_app: robot
my_models: Check_Monitor_Task, Action_Manager, Questions_Answers_Task

Step1: models
Step2: python3 manager makemigrations

Migrations for 'robot':
robot/migrations/0001_initial.py
- Create model Action_Manager
- Create model Check_Monitor_Task
- Create model Questions_Answers_Task

Step3: python3 manager migrate

Operations to perform:
Apply all migrations: admin, auth, contenttypes, robot, sessions
Running migrations:
Applying robot.0001_initial... OK

Step4: confirm the tables
There is record in django_migrations

sqlite> select * from django_migrations order by id desc limit 3;
id|app|name|applied
25|robot|0001_initial|2022-05-11 17:33:16.780900
18|sessions|0001_initial|2022-05-10 21:30:28.049031
17|auth|0012_alter_user_first_name_max_length|2022-05-10 21:30:27.985724

But no tables showed:

python3 manage.py dbshell
SQLite version 3.21.0 2017-10-24 18:55:49
Enter ".help" for usage hints.
sqlite> .tables
auth_group auth_user_user_permissions
auth_group_permissions django_admin_log
auth_permission django_content_type
auth_user django_migrations
auth_user_groups django_session
sqlite>

I have tried to delete 1.migration files, 2.pycache, 3.sqlite3.db but working like this every times.
Please tell my why, and how to create table. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文