File: //usr/lib/python3/dist-packages/django/core/management/commands/__pycache__/migrate.cpython-310.pyc
o
3�a�A � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZmZm Z d dl
mZmZ d dl
mZmZmZ d dlmZ d dlmZ d d lmZ d d
lmZmZ d dlmZ d dlmZ G d
d� de�ZdS )� N)�
import_module)�apps)�BaseCommand�CommandError�no_translations)�emit_post_migrate_signal�emit_pre_migrate_signal)�DEFAULT_DB_ALIAS�connections�router)�MigrationAutodetector)�MigrationExecutor)�AmbiguityError)�
ModelState�ProjectState)�module_has_submodule)� Truncatorc @ sF e Zd ZdZg Zdd� Zedd� �Zddd �Zd
d� Z e
dd
� �ZdS )�CommandzMUpdates database schema. Manages both apps with migrations and those without.c C s� |j dddd� |j dddd� |j d dd
d� |j ddd
ddd� |j dtdd� |j dddd� |j dddd� |j dddd� |j dddd� |j ddddd� d S )Nz
--skip-checks�
store_truezSkip system checks.)�action�help� app_label�?z5App label of an application to synchronize the state.)�nargsr �migration_namezpDatabase state will be brought to the state after that migration. Use the name "zero" to unapply all migrations.z --noinputz
--no-input�store_false�interactivez:Tells Django to NOT prompt the user for input of any kind.)r �destr z
--databasezHNominates a database to synchronize. Defaults to the "default" database.)�defaultr z--fakez5Mark migrations as run without actually running them.z--fake-initialz�Detect if tables already exist and fake-apply initial migrations if so. Make sure that the current database schema matches your initial migration before using this flag. Django will only check for an existing table name.z--planz=Shows a list of the migration actions that will be performed.z--run-syncdbz+Creates tables for apps without migrations.z--check�check_unappliedz;Exits with a non-zero status if unapplied migrations exist.)�add_argumentr )�self�parser� r# �I/usr/lib/python3/dist-packages/django/core/management/commands/migrate.py�
add_arguments sR ���������
�zCommand.add_argumentsc !
s� |d }|d s| j |gd� |d | _|d | _t�� D ]}t|jd�r+td|j� qt | }|�
� t|| j�}|j
�|� |j
�� }|rYd�d d
� |�� D ��}td| ��|d } d
}
|d r�|d � zt�� � W n ty� } ztt|���d }~ww | r�� |j
jv r�td� ��n� |j
jvr�td� ��|d r�|d r�|d }|dkr�� d fg}
n-z |j
�� |�}W n ty� td|� f �� ty� td|� f ��w � |jfg}
d}
n|d r� fdd�|j
j�� D �}
n|j
j�� }
|�|
�}|�o|d }|d �r[| j�d| jj � |�s| j�d� |D ]1\}}| j�t|�| jj!� |j"D ]}| �#||�\}}|�rB| jj$nd }| j�d| |� �q1�q|�rYt%�&d� d S |�rct%�&d� |d �ok|j
j'} | jdk�r�| j�| j�!d�� | �r�|d �r�| j�| j� d� �� n| j�| j� d �d!�t(|j
j'�� � |
�r�| j�| j� d"�d!�t(d#d$� |
D ����p�d% � n4|
d& d d u �r�| j�| j� d'�t|
d& d& � � n| j�| j� d(�d)|
d& d |
d& d& f � |j)d
d*�}|j}t*| j| j|j+||d+� | �r2| jdk�r| j�| j�!d,�� |d �r*| �,|� g� n| �,||j
j'� | jdk�rB| j�| j�!d-�� |�s�| jdk�r�| j�d.� t-|j
�.� t/�0t��}|j1|j
jd/�}|�r�| j�| j�2d0d!�d1d
� t(|�D �� �� | j�| j�2d2�� d}d}n|d3 }|d4 }|j3|
||�4� ||d5�}|�5� |j}|�6� �! g }|j7D ]}|j8|j9f} |�:| � |j;| � �q�W d � n 1 �s�w Y |�<d6d� |D �� t=| j| j|j+||d+� d S )7N�database�skip_checks)� databases� verbosityr �
managementz.managementz; c s s&