• Django数据库的迁移命令


    Django数据库的迁移命令

    当模型类写好之后我们通常要进行数据库的迁移才能在数据库中创建表

    1. 生成迁移文件

      python manage.py makemigrations
      
    2. 同步到数据库中

      python manage.py migrate
      

    例如

    (pythonvenv) C:UsersHarryDesktopguiderobot_pythonpathfinder>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:UsersHarryDesktopguiderobot_pythonpathfinder>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:UsersHarryDesktopguiderobot_pythonpathfinder>
    
    python
  • 相关阅读:
    Android—应用程序开机自启
    Android—简单的仿QQ聊天界面
    Android—关于自定义对话框的工具类
    Android—基于GifView显示gif动态图片
    Android—ListView条目背景为图片时,条目间距问题解决
    Android—自定义开关按钮实现
    FileProvider的使用
    Android 7.0新特性
    Android SDK自带调试优化工具
    Android监视器概述
  • 原文地址:https://www.cnblogs.com/bky20061005/p/14951593.html
Copyright © 2020-2023  润新知