zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    while(~scanf(..))为什么可以这样写
    【 HDU3294 】Girls' research (Manacher)
    【 HDU2966 】In case of failure(KD-Tree)
    【 HDU 1538 】A Puzzle for Pirates (海盗博弈论)
    【 HDU 2177 】取(2堆)石子游戏 (威佐夫博弈)
    【 HDU 4936 】Rainbow Island (hash + 高斯消元)
    【 HDU1081 】 To The Max (最大子矩阵和)
    Partition Numbers的计算
    【 HDU
    【 Gym 101116K 】Mixing Bowls(dfs)
  • 原文地址:https://www.cnblogs.com/bky20061005/p/14951593.html
Copyright © 2011-2022 走看看