Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/django/db/migrations/__pycache__/ |
Upload File : |
o 3�a�� � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z d dl mZ d dlm Z d dlmZ d d lmZ d d lmZmZ d dlmZ G dd � d �ZdS )� N)�chain)�settings)�models)� operations)� Migration)�AlterModelOptions)�MigrationOptimizer)�MigrationQuestioner)�COMPILED_REGEX_TYPE�RegexObject)�stable_topological_sortc @ st e Zd ZdZdXdd�ZdYdd�Zdd� Zd d � ZdZdd�Zd d� Z dd� Z edd� �ZdXdd�Z dd� Zdd� Zdd� Zd[dd�Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Z d<d=� Z!d>d?� Z"d@dA� Z#dBdC� Z$dDdE� Z%dFdG� Z&dHdI� Z'dJdK� Z(dLdM� Z)dNdO� Z*dPdQ� Z+dXdRdS�Z,dTdU� Z-e.dVdW� �Z/dS )\�MigrationAutodetectora Take a pair of ProjectStates and compare them to see what the first would need doing to make it match the second (the second usually being the project's current state). Note that this naturally operates on entire projects at a time, as it's likely that changes interact (for example, you can't add a ForeignKey without having a migration to add the table it depends on first). A user interface may offer single-app usage if it wishes, with the caveat that it may not always be possible. Nc C s. || _ || _|p t� | _dd� |jD �| _d S )Nc S s h | ]\}}|�qS � r )�.0�app�modelr r �C/usr/lib/python3/dist-packages/django/db/migrations/autodetector.py� <setcomp>! � z1MigrationAutodetector.__init__.<locals>.<setcomp>)� from_state�to_stater � questionerr � existing_apps)�selfr r r r r r �__init__ s zMigrationAutodetector.__init__c C s. | � ||�}| �|||�}|r| �||�}|S )z� Main entry point to produce a list of applicable changes. Take a graph to base names on and an optional set of apps to try and restrict to (restriction is not guaranteed) )�_detect_changes�arrange_for_graph� _trim_to_apps)r �graph�trim_to_apps�convert_apps�migration_name�changesr r r r"