Django数据库的迁移命令
Django数据库的迁移命令
当模型类写好之后我们通常要进行数据库的迁移才能在数据库中创建表
-
生成迁移文件
python manage.py makemigrations
-
同步到数据库中
python manage.py migrate
例如
(pythonvenv) C:\Users\Harry\Desktop\guiderobot_python\pathfinder>python manage.py makemigrations
到了定时任务
scheduler 已经配置完成
INFO views 135 Starting scheduler...
Error getting due jobs from job store 'default': (1146, "Table 'guiderobot.django_apscheduler_djangojob' doesn't exist")
No changes detected
(pythonvenv) C:\Users\Harry\Desktop\guiderobot_python\pathfinder>python manage.py migrate
到了定时任务
scheduler 已经配置完成
INFO views 135 Starting scheduler...
System check identified some issues:
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.2/ref/databases/#mysql-sql-mode
Error getting due jobs from job store 'default': (1146, "Table 'guiderobot.django_apscheduler_djangojob' doesn't exist")
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_apscheduler, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying django_apscheduler.0001_initial... OK
Applying django_apscheduler.0002_auto_20180412_0758... OK
Applying django_apscheduler.0003_auto_20200716_1632... OK
Applying django_apscheduler.0004_auto_20200717_1043... OK
Applying django_apscheduler.0005_migrate_name_to_id... OK
Applying django_apscheduler.0006_remove_djangojob_name... OK
Applying django_apscheduler.0007_auto_20200717_1404... OK
Applying django_apscheduler.0008_remove_djangojobexecution_started... OK
Applying sessions.0001_initial... OK
(pythonvenv) C:\Users\Harry\Desktop\guiderobot_python\pathfinder>
python