File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/django/db/migrations/operations/__pycache__/base.cpython-310.pyc
Back
o �h� � @ s d dl mZ G dd� d�ZdS )� )�routerc @ s� e Zd ZdZdZdZdZdZg Zdd� Z dd� Z dd � Zd d� Zdd � Z dd� Zedd� �Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )� Operationa) Base class for migration operations. It's responsible for both mutating the in-memory model state (see db/migrations/state.py) to represent what it performs, as well as actually performing it against a live database. Note that some operations won't modify memory state at all (e.g. data copying operations), and some will need their modifications to be optionally specified by the user (e.g. custom Python code snippets) Due to the way this class deals with deconstruction, it should be considered immutable. TFc O s t �| �}||f|_|S )N)�object�__new__�_constructor_args)�cls�args�kwargs�self� r �Z/usr/local/CyberPanel/lib/python3.10/site-packages/django/db/migrations/operations/base.pyr $ s zOperation.__new__c C s | j j| jd | jd fS )z� Return a 3-tuple of class import path (or just name if it lives under django.db.migrations), positional arguments, and keyword arguments. r � �� __class__�__name__r �r r r r �deconstruct* s �zOperation.deconstructc C � t d��)z� Take the state from the previous migration, and mutate it so that it matches what this migration would perform. z>subclasses of Operation must provide a state_forwards() method��NotImplementedError)r � app_label�stater r r �state_forwards6 � �zOperation.state_forwardsc C r )zi Perform the mutation on the database schema in the normal (forwards) direction. zAsubclasses of Operation must provide a database_forwards() methodr �r r � schema_editor� from_state�to_stater r r �database_forwards? r zOperation.database_forwardsc C r )z� Perform the mutation on the database schema in the reverse direction - e.g. if this were CreateModel, it would in fact drop the model's table. zBsubclasses of Operation must provide a database_backwards() methodr r r r r �database_backwardsH s �zOperation.database_backwardsc C s d| j j| jf S )zA Output a brief summary of what the action does. z%s: %sr r r r r �describeR s zOperation.describec C � dS )z� A filename part suitable for automatically naming a migration containing this operation, or None if not applicable. Nr r r r r �migration_name_fragmentX s z!Operation.migration_name_fragmentc C r! )a� Return True if there is a chance this operation references the given model name (as a string), with an app label for accuracy. Used for optimization. If in doubt, return True; returning a false positive will merely make the optimizer a little less efficient, while returning a false negative may result in an unusable optimized migration. Tr )r �namer r r r �references_model` s zOperation.references_modelc C s | � ||�S )z� Return True if there is a chance this operation references the given field name, with an app label for accuracy. Used for optimization. If in doubt, return True. )r$ )r � model_namer# r r r r �references_fieldl s zOperation.references_fieldc C s |j �|�sdS t�||�S )z� Return whether or not a model may be migrated. This is a thin wrapper around router.allow_migrate_model() that preemptively rejects any proxy, swapped out, or unmanaged model. F)�_meta�can_migrater �allow_migrate_model)r �connection_alias�modelr r r r) u s zOperation.allow_migrate_modelc C s | j r|gS |j r| gS dS )z� Return either a list of operations the actual operation should be replaced with or a boolean that indicates whether or not the specified operation can be optimized across. F)�elidable)r � operationr r r r �reduce� s zOperation.reducec C s>