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
  • 相关阅读:
    Oracle系列二 基本的SQL SELECT语句
    Oracle系列一 SQL语句基本概念和学习准备
    Android 动态更换桌面图标
    Linux_CentOS下搭建Nodejs 生产环境-以及nodejs进程管理器pm2的使用
    Linux_CentOS中Mongodb4.x 安装调试、远程管理、配置 mongodb 管理员密码
    Linux_CentOS 中systemctl 管理服务、防火墙 firewalld 以及 SELinux 配置
    Linux_CentOS 内存、cpu、进程、端口、硬盘管理
    Linux_CentOS中的MySQL 数据库的安装调试、远程管理
    LInux_CentosOS中yum安装jdk及配置环境变量
    Linux_CentOS软件安装调试 源代码包编译安装和 二进制包配置
  • 原文地址:https://www.cnblogs.com/bky20061005/p/14951593.html
Copyright © 2011-2022 走看看