Commit f6463bb3 authored by Tim Graham's avatar Tim Graham
Browse files

Removed the syncdb command per deprecation timeline.

parent f4f24d30
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ def call_command(name, *args, **options):
    This is the primary API you should use for calling specific commands.

    Some examples:
        call_command('syncdb')
        call_command('migrate')
        call_command('shell', plain=True)
        call_command('sqlmigrate', 'myapp')
    """
+0 −45
Original line number Diff line number Diff line
import warnings

from django.apps import apps
from django.contrib.auth import get_user_model
from django.db import DEFAULT_DB_ALIAS
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.six.moves import input


class Command(BaseCommand):
    help = "Deprecated - use 'migrate' instead."

    def add_arguments(self, parser):
        parser.add_argument('--noinput', action='store_false', dest='interactive', default=True,
            help='Tells Django to NOT prompt the user for input of any kind.')
        parser.add_argument('--no-initial-data', action='store_false', dest='load_initial_data', default=True,
            help='Tells Django not to load any initial data after database synchronization.')
        parser.add_argument('--database', default=DEFAULT_DB_ALIAS,
            help='Nominates a database to synchronize. Defaults to the "default" database.')

    def handle(self, **options):
        warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)
        call_command("migrate", **options)

        try:
            apps.get_model('auth', 'Permission')
        except LookupError:
            return

        UserModel = get_user_model()

        if not UserModel._default_manager.exists() and options.get('interactive'):
            msg = ("\nYou have installed Django's auth system, and "
                "don't have any superusers defined.\nWould you like to create one "
                "now? (yes/no): ")
            confirm = input(msg)
            while 1:
                if confirm not in ('yes', 'no'):
                    confirm = input('Please enter either "yes" or "no": ')
                    continue
                if confirm == 'yes':
                    call_command("createsuperuser", interactive=True, database=options['database'])
                break
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ class BaseDatabaseSchemaEditor(object):
    It is intended to eventually completely replace DatabaseCreation.

    This class should be used by creating an instance for each set of schema
    changes (e.g. a syncdb run, a migration file), and by first calling start(),
    changes (e.g. a migration file), and by first calling start(),
    then the relevant actions, and then commit(). This is necessary to allow
    things like circular foreign key references - FKs will only be created once
    commit() is called.
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ class MigrationRecorder(object):
    Deals with storing migration records in the database.

    Because this table is actually itself used for dealing with model
    creation, it's the one thing we can't do normally via syncdb or migrations.
    creation, it's the one thing we can't do normally via migrations.
    We manually handle table creation/schema updating (using schema backend)
    and then have a floating model to do queries with.

+0 −17
Original line number Diff line number Diff line
@@ -751,10 +751,6 @@ The behavior of this command changes depending on the arguments provided:
  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 :mod:`django.contrib.auth`). Use
:djadmin:`createsuperuser` to do that if you wish.

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

@@ -1264,19 +1260,6 @@ for :djadmin:`startapp`.

.. _`template source`: https://github.com/django/django/tree/master/django/conf/project_template/

syncdb
------

.. django-admin:: syncdb

.. deprecated:: 1.7

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

Alias for :djadmin:`migrate`.

test <app or test identifier>
-----------------------------

Loading