← Back
Editing: schema.cpython-311.pyc
� �|�eQ � � � d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl m Z d dlmZ d dl mZ d d lmZ G d � de� � ZdS )� N)�Decimal)�Apps)�NotSupportedError)�BaseDatabaseSchemaEditor)� Statement)�strip_quotes)�UniqueConstraint)�atomicc � � � e Zd ZdZdZdZdZdZ� fd�Z� fd�Z d� Z dd �Zd� fd� Zd� fd � Z dd�Zd� fd� Zd� Zd� Z dd�Zd� Z� fd�Z� fd�Zd� Z� xZS )�DatabaseSchemaEditorzDROP TABLE %(table)sNzEREFERENCES %(to_table)s (%(to_column)s) DEFERRABLE INITIALLY DEFERREDz7CREATE UNIQUE INDEX %(name)s ON %(table)s (%(columns)s)zDROP INDEX %(name)sc � �� | j � � � st d� � �t � � � � � S )Nz�SQLite schema editor cannot be used while foreign key constraint checks are enabled. Make sure to disable them before entering a transaction.atomic() context because SQLite does not support disabling them in the middle of a multi-statement transaction.)� connection�disable_constraint_checkingr �super� __enter__)�self� __class__s ��C/usr/lib/python3/dist-packages/django/db/backends/sqlite3/schema.pyr zDatabaseSchemaEditor.__enter__ sJ �� � ��:�:�<�<� �#�1�� � � �w�w� � �"�"�"� c � �� | j � � � t � � � |||� � | j � � � d S �N)r �check_constraintsr �__exit__�enable_constraint_checking)r �exc_type� exc_value� tracebackr s �r r zDatabaseSchemaEditor.__exit__"