zoukankan      html  css  js  c++  java
  • Django中的syncdb命令

      从官方文档的意思来看,现在他已经成为migrate命令的同义词了,和migrate命令有相同的作用。

    Deprecated since version 1.7: This command has been deprecated in favor of the migrate command, which performs both the old behavior as well as executing migrations. It is now just an alias to that command

      migrate命令的作用:

    migrate [<app_label> [<migrationname>]]

    django-admin migrate
    New in Django 1.7.

    Synchronizes the database state with the current set of models and migrations. Migrations, their relationship with apps and more are covered in depth in the migrations documentation.

    The behavior of this command changes depending on the arguments provided:

    • No arguments: All migrated apps have all of their migrations run, and all unmigrated apps are synchronized with the database,
    • <app_label>: The specified app has its migrations run, up to the most recent migration. This may involve running other apps’ migrations too, due to dependencies.
    • <app_label> <migrationname>: Brings the database schema to a state where the named migration is applied, but no later migrations in the same app are applied. This may involve unapplying migrations if you have previously migrated past the named migration. Use the name zero to unapply all migrations for an app.

    Unlike syncdb, this command does not prompt you to create a superuser if one doesn’t exist (assuming you are using django.contrib.auth). Use createsuperuser to do that if you wish.

    The --database option can be used to specify the database to migrate.

    --fake

    The --fake option tells Django to mark the migrations as having been applied or unapplied, but without actually running the SQL to change your database schema.

    This is intended for advanced users to manipulate the current migration state directly if they’re manually applying changes; be warned that using --fake runs the risk of putting the migration state table into a state where manual recovery will be needed to make migrations run correctly.

    New in Django 1.8.
    --fake-initial

    The --fake-initial option can be used to allow Django to skip an app’s initial migration if all database tables with the names of all models created by all CreateModel operations in that migration already exist. This option is intended for use when first running migrations against a database that preexisted the use of migrations. This option does not, however, check for matching database schema beyond matching table names and so is only safe to use if you are confident that your existing schema matches what is recorded in your initial migration.

    Deprecated since version 1.8: The --list option has been moved to the showmigrations command.

  • 相关阅读:
    数据库02
    MySQL1
    GIL 死锁 递归锁 event 信号量 线程Queue
    小脚本 暴力删除文件 刷屏
    常见web攻击 及基础 回顾(杂记)
    接口中的简单异步 async
    python协程 示例
    python 利用jinja2模板生成html
    python 调用webservices 接口
    python 进程 进程池 进程间通信
  • 原文地址:https://www.cnblogs.com/Blaxon/p/4415084.html
Copyright © 2011-2022 走看看