
    (ph-                        S SK JrJrJr  S SKJrJr  S SKJrJ	r	J
r
  S SKJr  S SKJr   " S S\5      r " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S\\	5      r " S S\\
5      r " S S\5      r " S  S!\5      r " S" S#\5      r " S$ S%\5      r " S& S'\5      rg())    )get_citext_oidsget_hstore_oidsregister_type_handlers)NotSupportedErrorrouter)AddConstraintAddIndexRemoveIndex)	Operation)CheckConstraintc                   L    \ rS rSrSrS rS rS rS rS r	S r
\S	 5       rS
rg)CreateExtension   Tc                     Xl         g Nname)selfr   s     U/var/www/html/venv/lib/python3.13/site-packages/django/contrib/postgres/operations.py__init__CreateExtension.__init__   s    	    c                     g r    r   	app_labelstates      r   state_forwardsCreateExtension.state_forwards       r   c                 J   UR                   R                  S:w  d0  [        R                  " UR                   R                  U5      (       d  g U R                  X R                  5      (       d-  UR                  SUR                  U R                  5      -  5        [        R                  " 5         [        R                  " 5         [        UR                   5        [        UR                   S5      (       a1  UR                   R                  UR                   R                   S5        g g )N
postgresqlz!CREATE EXTENSION IF NOT EXISTS %sregister_geometry_adaptersT)
connectionvendorr   allow_migratealiasextension_existsr   execute
quote_namer   cache_clearr   r   hasattrr#   r   r   schema_editor
from_stateto_states        r   database_forwards!CreateExtension.database_forwards   s    ##**l:&BVBV$$**IC
 C
 $$]II>>!!3**49956
 	##%##% 	}778=++-IJJ$$??((33T Kr   c                 T   [         R                  " UR                  R                  U5      (       d  g U R	                  X R
                  5      (       a-  UR                  SUR                  U R
                  5      -  5        [        R                  " 5         [        R                  " 5         g )NzDROP EXTENSION IF EXISTS %s)r   r&   r$   r'   r(   r   r)   r*   r   r+   r   r-   s        r   database_backwards"CreateExtension.database_backwards+   sx    ##M$<$<$B$BINN  		::!!-0H0H0SS 	##%##%r   c                     UR                   R                  5        nUR                  SU/5        [        UR	                  5       5      sS S S 5        $ ! , (       d  f       g = f)Nz-SELECT 1 FROM pg_extension WHERE extname = %s)r$   cursorr)   boolfetchone)r   r.   	extensionr7   s       r   r(    CreateExtension.extension_exists6   sG    %%,,.&NN? )* /..s   ,A
Ac                      SU R                   -  $ )NzCreates extension %sr   r   s    r   describeCreateExtension.describe>   s    %		11r   c                      SU R                   -  $ )Nzcreate_extension_%sr   r=   s    r   migration_name_fragment'CreateExtension.migration_name_fragmentA   s    $tyy00r   r   N)__name__
__module____qualname____firstlineno__
reversibler   r   r1   r4   r(   r>   propertyrA   __static_attributes__r   r   r   r   r      s9    J,	&+2 1 1r   r   c                       \ rS rSrS rSrg)BloomExtensionF   c                     SU l         g )Nbloomr   r=   s    r   r   BloomExtension.__init__G   s	    	r   r   NrC   rD   rE   rF   r   rI   r   r   r   rK   rK   F   s    r   rK   c                       \ rS rSrS rSrg)BtreeGinExtensionK   c                     SU l         g )N	btree_ginr   r=   s    r   r   BtreeGinExtension.__init__L   s	    	r   r   NrP   r   r   r   rR   rR   K   s     r   rR   c                       \ rS rSrS rSrg)BtreeGistExtensionP   c                     SU l         g )N
btree_gistr   r=   s    r   r   BtreeGistExtension.__init__Q   s	     	r   r   NrP   r   r   r   rX   rX   P   s    !r   rX   c                       \ rS rSrS rSrg)CITextExtensionU   c                     SU l         g )Ncitextr   r=   s    r   r   CITextExtension.__init__V   	    	r   r   NrP   r   r   r   r^   r^   U       r   r^   c                       \ rS rSrS rSrg)CryptoExtensionZ   c                     SU l         g )Npgcryptor   r=   s    r   r   CryptoExtension.__init__[   	    	r   r   NrP   r   r   r   rf   rf   Z       r   rf   c                       \ rS rSrS rSrg)HStoreExtension_   c                     SU l         g )Nhstorer   r=   s    r   r   HStoreExtension.__init__`   rc   r   r   NrP   r   r   r   rn   rn   _   rd   r   rn   c                       \ rS rSrS rSrg)TrigramExtensiond   c                     SU l         g )Npg_trgmr   r=   s    r   r   TrigramExtension.__init__e   s	    	r   r   NrP   r   r   r   rt   rt   d   s    r   rt   c                       \ rS rSrS rSrg)UnaccentExtensioni   c                     SU l         g )Nunaccentr   r=   s    r   r   UnaccentExtension.__init__j   rk   r   r   NrP   r   r   r   rz   rz   i   rl   r   rz   c                       \ rS rSrS rSrg)NotInTransactionMixinn   c                 ~    UR                   R                  (       a"  [        SU R                  R                  -  5      eg )Nz_The %s operation cannot be executed inside a transaction (set atomic = False on the migration).)r$   in_atomic_blockr   	__class__rC   r   r.   s     r   _ensure_not_in_transaction0NotInTransactionMixin._ensure_not_in_transactiono   s;    ##33#9;?>>;R;RS  4r   r   N)rC   rD   rE   rF   r   rI   r   r   r   r   r   n   s    r   r   c                   .    \ rS rSrSrSrS rS rS rSr	g)	AddIndexConcurrentlyw   zDCreate an index using PostgreSQL's CREATE INDEX CONCURRENTLY syntax.Fc                     SU R                   R                  < SSR                  U R                   R                  5      < SU R                  < 3$ )NzConcurrently create index z on field(s) , z
 of model )indexr   joinfields
model_namer=   s    r   r>   AddIndexConcurrently.describe|   s4    JJOOIIdjj''(OO
 	
r   c                     U R                  U5        UR                  R                  XR                  5      nU R	                  UR
                  R                  U5      (       a  UR                  XPR                  SS9  g g NT)concurrently)	r   apps	get_modelr   allow_migrate_modelr$   r'   	add_indexr   r   r   r.   r/   r0   models         r   r1   &AddIndexConcurrently.database_forwards   sd    ''6''	??C##M$<$<$B$BEJJ##E::D#I Kr   c                     U R                  U5        UR                  R                  XR                  5      nU R	                  UR
                  R                  U5      (       a  UR                  XPR                  SS9  g g r   )	r   r   r   r   r   r$   r'   remove_indexr   r   s         r   r4   'AddIndexConcurrently.database_backwards   sd    ''6)))__E##M$<$<$B$BEJJ&&ujjt&L Kr   r   N
rC   rD   rE   rF   __doc__atomicr>   r1   r4   rI   r   r   r   r   r   w   s    NF
JMr   r   c                   .    \ rS rSrSrSrS rS rS rSr	g)	RemoveIndexConcurrently   zBRemove an index using PostgreSQL's DROP INDEX CONCURRENTLY syntax.Fc                 >    SU R                   < SU R                  < 3$ )NzConcurrently remove index z from r   r   r=   s    r   r>    RemoveIndexConcurrently.describe   s    9=DOOTTr   c                 R   U R                  U5        UR                  R                  XR                  5      nU R	                  UR
                  R                  U5      (       aF  UR                  XR                  4   nUR                  U R                  5      nUR                  XWSS9  g g r   )r   r   r   r   r   r$   r'   modelsmodel_name_lowerget_index_by_namer   r   )r   r   r.   r/   r0   r   from_model_stater   s           r   r1   )RemoveIndexConcurrently.database_forwards   s    ''6)))__E##M$<$<$B$BEJJ)00<Q<Q1QR$66tyyAE&&u$&G Kr   c                 R   U R                  U5        UR                  R                  XR                  5      nU R	                  UR
                  R                  U5      (       aF  UR                  XR                  4   nUR                  U R                  5      nUR                  XWSS9  g g r   )r   r   r   r   r   r$   r'   r   r   r   r   r   )r   r   r.   r/   r0   r   to_model_stater   s           r   r4   *RemoveIndexConcurrently.database_backwards   s    ''6''	??C##M$<$<$B$BEJJ%__Y8M8M-MNN"44TYY?E##Et#D Kr   r   Nr   r   r   r   r   r      s    LFUHEr   r   c                   <    \ rS rSrSSS.S jrS rS rS rS	 rS
r	g)CollationOperation   libcT)providerdeterministicc                4    Xl         X l        X0l        X@l        g r   )r   localer   r   )r   r   r   r   r   s        r   r   CollationOperation.__init__   s    	 *r   c                     g r   r   r   s      r   r   !CollationOperation.state_forwards   r    r   c                    U R                   U R                  S.nU R                  (       a  U R                  S:w  a  U R                  US'   U R                  SL a  U R                  US'   U R                  R
                  / U4$ )N)r   r   r   r   Fr   )r   r   r   r   r   rE   )r   kwargss     r   deconstructCollationOperation.deconstruct   so    ))t{{;==T]]f4!%F:&&*&8&8F?#NN''
 	
r   c           	      j   SUR                  U R                  5      0nU R                  S:w  a  UR                  U R                  5      US'   U R                  SL a  SUS'   UR	                  SUR                  U R
                  5      SR                  S	 UR                  5        5       5      S
.-  5        g )Nr   r   r   Ffalser   z$CREATE COLLATION %(name)s (%(args)s)r   c              3   4   #    U  H  u  pU S U 3v   M     g7f)=Nr   ).0optionvalues      r   	<genexpr>6CollationOperation.create_collation.<locals>.<genexpr>   s       "=IMFvhaw'\s   )r   args)r*   r   r   r   r)   r   r   items)r   r.   r   s      r   create_collation#CollationOperation.create_collation   s    -224;;?@==F",77FD&$+D!2%00;		 "=AZZ\" 	
r   c                 ^    UR                  SUR                  U R                  5      -  5        g )NzDROP COLLATION %s)r)   r*   r   r   s     r   remove_collation#CollationOperation.remove_collation   s'    -":":499"EE	
r   )r   r   r   r   N)
rC   rD   rE   rF   r   r   r   r   r   rI   r   r   r   r   r      s     17t +


 
r   r   c                   :    \ rS rSrSrS rS rS r\S 5       r	Sr
g)	CreateCollation   zCreate a collation.c                     UR                   R                  S:w  d0  [        R                  " UR                   R                  U5      (       d  g U R                  U5        g Nr"   )r$   r%   r   r&   r'   r   r-   s        r   r1   !CreateCollation.database_forwards   N    ##**l:&BVBV$$**IC
 C
 m,r   c                     [         R                  " UR                  R                  U5      (       d  g U R	                  U5        g r   )r   r&   r$   r'   r   r-   s        r   r4   "CreateCollation.database_backwards   2    ##M$<$<$B$BINNm,r   c                      SU R                    3$ )NzCreate collation r   r=   s    r   r>   CreateCollation.describe       "499+..r   c                 <    SU R                   R                  5       -  $ )Nzcreate_collation_%sr   lowerr=   s    r   rA   'CreateCollation.migration_name_fragment       $tyy'888r   r   NrC   rD   rE   rF   r   r1   r4   r>   rH   rA   rI   r   r   r   r   r      (    --
/ 9 9r   r   c                   :    \ rS rSrSrS rS rS r\S 5       r	Sr
g)	RemoveCollation   zRemove a collation.c                     UR                   R                  S:w  d0  [        R                  " UR                   R                  U5      (       d  g U R                  U5        g r   )r$   r%   r   r&   r'   r   r-   s        r   r1   !RemoveCollation.database_forwards   r   r   c                     [         R                  " UR                  R                  U5      (       d  g U R	                  U5        g r   )r   r&   r$   r'   r   r-   s        r   r4   "RemoveCollation.database_backwards   r   r   c                      SU R                    3$ )NzRemove collation r   r=   s    r   r>   RemoveCollation.describe   r   r   c                 <    SU R                   R                  5       -  $ )Nzremove_collation_%sr   r=   s    r   rA   'RemoveCollation.migration_name_fragment   r   r   r   Nr   r   r   r   r   r      r   r   r   c                   N   ^  \ rS rSrSrU 4S jrS rS r\U 4S j5       r	Sr
U =r$ )AddConstraintNotValidi  z[
Add a table constraint without enforcing validation, using PostgreSQL's
NOT VALID syntax.
c                 d   > [        U[        5      (       d  [        S5      e[        TU ]  X5        g )Nz<AddConstraintNotValid.constraint must be a check constraint.)
isinstancer   	TypeErrorsuperr   )r   r   
constraintr   s      r   r   AddConstraintNotValid.__init__	  s/    *o66N  	0r   c                 R    SU R                   R                  < SU R                  < 3$ )NzCreate not valid constraint 
 on model )r   r   r   r=   s    r   r>   AddConstraintNotValid.describe  s     OO  OO
 	
r   c                 $   UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a@  U R                  R                  XR5      nU(       a  UR                  [        U5      S-   S S9  g g g )Nz
 NOT VALID)params)
r   r   r   r   r$   r'   r   
create_sqlr)   str)r   r   r.   r/   r0   r   constraint_sqls          r   r1   'AddConstraintNotValid.database_forwards  s{    )))__E##M$<$<$B$BEJJ!__77MN %%c.&9L&HQU%V	  Kr   c                    > [         TU ]  S-   $ )N
_not_valid)r   rA   )r   r   s    r   rA   -AddConstraintNotValid.migration_name_fragment   s    w.==r   r   )rC   rD   rE   rF   r   r   r>   r1   rH   rA   rI   __classcell__)r   s   @r   r   r     s,    
1
W > >r   r   c                   L    \ rS rSrSrS rS rS rS rS r	\
S 5       rS	 rS
rg)ValidateConstrainti%  z&Validate a table NOT VALID constraint.c                     Xl         X l        g r   r   r   )r   r   r   s      r   r   ValidateConstraint.__init__(  s    $	r   c                 >    SU R                   < SU R                  < 3$ )NzValidate constraint r   r   r=   s    r   r>   ValidateConstraint.describe,  s    7;yy$//RRr   c                 P   UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       aV  UR                  SUR                  UR                  R                  5      < SUR                  U R                  5      < 35        g g )NzALTER TABLE z VALIDATE CONSTRAINT )r   r   r   r   r$   r'   r)   r*   _metadb_tabler   r   s         r   r1   $ValidateConstraint.database_forwards/  s~    )))__E##M$<$<$B$BEJJ!! ",,U[[-A-AB!,,TYY7 Kr   c                     g r   r   r-   s        r   r4   %ValidateConstraint.database_backwards:  s    r   c                     g r   r   r   s      r   r   !ValidateConstraint.state_forwards>  r    r   c                 t    U R                   R                  5       < SU R                  R                  5       < 3$ )N
_validate_)r   r   r   r=   s    r   rA   *ValidateConstraint.migration_name_fragmentA  s%    #'??#8#8#:DIIOO<MNNr   c                 b    U R                   R                  / U R                  U R                  S.4$ )Nr  )r   rC   r   r   r=   s    r   r   ValidateConstraint.deconstructE  s/    NN##"oo		
 	
r   r  N)rC   rD   rE   rF   r   r   r>   r1   r4   r   rH   rA   r   rI   r   r   r   r  r  %  s:    0S	 O O
r   r  N) django.contrib.postgres.signalsr   r   r   	django.dbr   r   django.db.migrationsr   r	   r
   $django.db.migrations.operations.baser   django.db.models.constraintsr   r   rK   rR   rX   r^   rf   rn   rt   rz   r   r   r   r   r   r   r   r  r   r   r   <module>r     s    
 0 E E : 871i 71t_ 
   
! !
o 
o 
o 
 
 
 M0( M2E3[ E2)
 )
X9( 9.9( 9.>M >D(
 (
r   