ó
ø¢TQc           @   sR   d  d l  Z  d  d l Z d  d l m Z d  d l m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   BaseDatabaseCreation(   t   inputt   DatabaseCreationc           B   sç   e  Z i d  d 6d d 6d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d  d 6d d 6d d 6d d 6d d 6d  d 6d d 6d d 6d d 6d d  6d! d" 6d# d$ 6Z d% „  Z d& „  Z d' „  Z d( „  Z d) „  Z d* „  Z d+ „  Z	 RS(,   t   integert	   AutoFieldt   boolt   BooleanFields   varchar(%(max_length)s)t	   CharFieldt   CommaSeparatedIntegerFieldt   datet	   DateFieldt   datetimet   DateTimeFieldt   decimalt   DecimalFieldt	   FileFieldt   FilePathFieldt   realt
   FloatFieldt   IntegerFieldt   bigintt   BigIntegerFields   char(15)t   IPAddressFields   char(39)t   GenericIPAddressFieldt   NullBooleanFieldt   OneToOneFields   integer unsignedt   PositiveIntegerFields   smallint unsignedt   PositiveSmallIntegerFieldt	   SlugFieldt   smallintt   SmallIntegerFieldt   textt	   TextFieldt   timet	   TimeFieldc         C   s   g  S(   s#   SQLite3 doesn't support constraints(    (   t   selft   modelt   stylet   pending_references(    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   sql_for_pending_references#   s    c         C   s   g  S(   s#   SQLite3 doesn't support constraints(    (   R#   R$   t   references_to_deleteR%   (    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   sql_remove_table_constraints'   s    c         C   s*   |  j  j d } | r& | d k r& | Sd S(   Nt	   TEST_NAMEs   :memory:(   t
   connectiont   settings_dict(   R#   t   test_database_name(    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   _get_test_db_name+   s    c         C   sÝ   |  j  ƒ  } | d k rÙ | d k r6 d |  j j GHn  t j | t j ƒ rÙ | sd t d | ƒ } n  | sv | d k rÁ y t j | ƒ WqÓ t k
 r½ } t	 j
 j d | ƒ t	 j d ƒ qÓ XqÖ d GHt	 j d ƒ qÙ n  | S(	   Ns   :memory:i   s$   Destroying old test database '%s'...sX   Type 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: t   yess0   Got an error deleting the old test database: %s
i   s   Tests cancelled.(   R.   R+   t   aliast   ost   accesst   F_OKR   t   removet	   Exceptiont   syst   stderrt   writet   exit(   R#   t	   verbosityt   autoclobberR-   t   confirmt   e(    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   _create_test_db1   s     c         C   s&   | r" | d k r" t  j | ƒ n  d  S(   Ns   :memory:(   R1   R4   (   R#   R-   R:   (    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   _destroy_test_dbE   s    c         C   s   d  |  j j _ d  S(   N(   t   NoneR+   t   isolation_level(   R#   (    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   set_autocommitJ   s    c         C   sW   |  j  j } |  j ƒ  } |  j  j d g } | d k rM | j |  j  j ƒ n  t | ƒ S(   s   
        Returns a tuple that uniquely identifies a test database.

        This takes into account the special cases of ":memory:" and "" for
        SQLite since the databases will be distinct despite having the same
        TEST_NAME. See http://www.sqlite.org/inmemorydb.html
        t   NAMEs   :memory:(   R+   R,   R.   t   appendR0   t   tuple(   R#   R,   t   test_dbnamet   sig(    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   test_db_signatureM   s    (
   t   __name__t
   __module__t
   data_typesR'   R)   R.   R>   R?   RB   RH   (    (    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyR      s<   
						(   R1   R6   t   django.db.backends.creationR    t   django.utils.six.movesR   R   (    (    (    s<   ../Django//lib/python/django/db/backends/sqlite3/creation.pyt   <module>   s   