
    h'&                     `    S SK r S SKJr  S SKJr  SSKJr   " S S5      r " S S	\5      r	S
 r
g)    N)get_migration_name_timestamp)atomic   )IrreversibleErrorc                   r    \ rS rSrSr/ r/ r/ r/ rSr	Sr
S rS rS rS rS	 rSS
 jrSS jrSS jrS rSrg)	Migration	   ae  
The base class for all migrations.

Migration files will import this from django.db.migrations.Migration
and subclass it as a class called Migration. It will have one or more
of the following attributes:

 - operations: A list of Operation instances, probably from
   django.db.migrations.operations
 - dependencies: A list of tuples of (app_path, migration_name)
 - run_before: A list of tuples of (app_path, migration_name)
 - replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or
Graph as instances, having been initialized with their app label and name.
NTc                 <   Xl         X l        [        U R                  R                  5      U l        [        U R                  R
                  5      U l        [        U R                  R                  5      U l        [        U R                  R                  5      U l        g N)name	app_labellist	__class__
operationsdependencies
run_beforereplaces)selfr   r   s      P/var/www/html/env/lib/python3.13/site-packages/django/db/migrations/migration.py__init__Migration.__init__7   se    	"t~~889 !<!<=t~~889T^^445    c                     [        U[        5      =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   )
isinstancer   r   r   )r   others     r   __eq__Migration.__eq__@   s;    ui( 2		UZZ'2%//1	
r   c                 @    SU R                   < SU R                  < S3$ )Nz<Migration .>r   r   r   s    r   __repr__Migration.__repr__G   s    &*nndii@@r   c                 <    U R                   < SU R                  < 3$ Nr   r!   r"   s    r   __str__Migration.__str__J   s    ..$))44r   c                 N    [        U R                  < SU R                  < 35      $ r&   )hashr   r   r"   s    r   __hash__Migration.__hash__M   s    t~~tyy9::r   c                     UnU(       a  UR                  5       nU R                   H  nUR                  U R                  U5        M!     U$ )z
Take a ProjectState and return a new one with the migration's
operations applied to it. Preserve the original object state by
default and return a mutated state from a copy.
)cloner   state_forwardsr   )r   project_statepreserve	new_state	operations        r   mutate_stateMigration.mutate_stateP   sB     "	%++-II$$T^^Y? )r   c                    U R                    GH  nU(       a  UR                  R                  S5        UR                  R                  SUR                  5       -  5        UR                  R                  S5        UR                  (       d  UR                  R                  S5        M  [        UR                  5      nUR                  5       nUR                  U R                  U5        UR                  =(       d!    U R                  =(       a    UR                  SLnUR                  (       dM  U(       aF  [        UR                  R                  5         UR                  U R                  X&U5        SSS5        OUR                  U R                  X&U5        U(       d  GM  W[        UR                  5      :X  d  GM  UR                  R                  S5        GM     U$ ! , (       d  f       NV= f)z
Take a project_state representing all migrations prior to this one
and a schema_editor for a live database and apply the migration
in a forwards order.

Return the resulting project state for efficient reuse by following
Migrations.
---- %s*-- THIS OPERATION CANNOT BE WRITTEN AS SQLFN
-- (no-op))r   collected_sqlappenddescribereduces_to_sqllenr.   r/   r   r   atomic_migration
connectionaliasdatabase_forwards)r   r0   schema_editorcollect_sqlr3   collected_sql_before	old_stateatomic_operations           r   applyMigration.apply^   s    I ++2248++227Y=O=O=Q3QR++2248 //!//66D '*=+F+F'G$%++-I$$T^^]C(//  =	 0 0 =  !116F M44::;//- <; ++NNMm {3s=;V;V7WW++22<@C )D  <;s   G  
G.	c                    / nUnU R                    Hx  nUR                  (       d  [        SU< SU < S35      eUR                  5       nUR                  5       nUR	                  U R
                  U5        UR                  SXgU45        Mz     U GH  u  phn	U(       a  UR                  R                  S5        UR                  R                  SUR                  5       -  5        UR                  R                  S5        UR                  (       d  UR                  R                  S5        M  [        UR                  5      n
UR                  =(       d!    U R                  =(       a    UR                  SLnUR                  (       dM  U(       aF  [        UR                  R                  5         UR!                  U R
                  X)U5        S	S	S	5        OUR!                  U R
                  X)U5        U(       d  GMl  W
[        UR                  5      :X  d  GM  UR                  R                  S
5        GM     U$ ! , (       d  f       NV= f)a  
Take a project_state representing all migrations prior to this one
and a schema_editor for a live database and apply the migration
in a reverse order.

The backwards migration process consists of two phases:

1. The intermediate states from right before the first until right
   after the last operation inside this migration are preserved.
2. The operations are applied in reverse order using the states
   recorded in step 1.
z
Operation z in z is not reversibler   r7   r8   r9   FNr:   )r   
reversibler   r.   r/   r   insertr;   r<   r=   r>   r?   r   r@   rA   rB   database_backwards)r   r0   rD   rE   to_runr2   r3   rG   to_state
from_staterF   rH   s               r   unapplyMigration.unapply   s    !	I'''>GN 
 ")I!)I$$T^^Y?MM!iI>? ) 06+I++2248++227Y=O=O=Q3QR++2248 //!//66D '*=+F+F'G$(//  =	 0 0 =  !116F M44::;008 <; ,,NNMx {3s=;V;V7WW++22<@7 068  <;s   -H99
I	c                    U R                   (       a  gU R                   Vs/ s H  oR                  PM     nnU Vs/ s H#  o3(       d  M  [        R                  " SSU5      PM%     nnU(       a"  [        U5      [        U R                  5      :w  a  S[        5       -  $ US   nUSS  H#  nU SU 3n[        U5      S:  a  U S	3n  U$ UnM%     U$ s  snf s  snf )
z
Suggest a name for the operations this migration might represent. Names
are not guaranteed to be unique, but put some effort into the fallback
name to avoid VCS conflicts if possible.
initialz\W+_zauto_%sr   r   N4   	_and_more)rU   r   migration_name_fragmentresubr?   r   )r   opraw_fragmentsr   	fragmentsfragmentnew_names          r   suggest_nameMigration.suggest_name   s     <<>BooNo33oN;HQ=4D.RVVFC.=	QC	Nc$//.BB;===|!!"Hq
+H8}r!y) D &  OQs   C
C
C)r   r   r   r   r   r   )T)F)__name__
__module____qualname____firstlineno____doc__r   r   r   r   rU   r   r   r   r#   r'   r+   r4   rI   rR   ra   __static_attributes__ r   r   r   r   	   sa    $ J L
 J
 H G F6
A5;+Z;zr   r   c                       \ rS rSrSrS rSrg)SwappableTuple   zs
Subclass of tuple so Django can tell this was originally a swappable
dependency when it reads the migration file.
c                 <    [         R                  X5      nX#l        U$ r   )tuple__new__setting)clsvaluerp   r   s       r   ro   SwappableTuple.__new__   s    }}S(r   )rp   N)rc   rd   re   rf   rg   ro   rh   ri   r   r   rk   rk      s    
r   rk   c                 D    [        U R                  SS5      S   S4U 5      $ )z'Turn a setting value into a dependency.r   r   r   	__first__)rk   split)rr   s    r   swappable_dependencyrw      s$    5;;sA.q1;?GGr   )rZ   django.db.migrations.utilsr   django.db.transactionr   
exceptionsr   r   rn   rk   rw   ri   r   r   <module>r{      s0    	 C ( )U Up	U 	Hr   