
    h(/                        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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OperationCategory)CheckConstraintc                   d    \ rS rSrSr\R                  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     T/var/www/html/env/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/   	extensionr8   s       r   r)    CreateExtension.extension_exists7   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_fragmentB   s    $tyy00r   r   N)__name__
__module____qualname____firstlineno__
reversibler   ADDITIONcategoryr   r   r2   r5   r)   r?   propertyrB   __static_attributes__r   r   r   r   r      sD    J ))H,	&+2 1 1r   r   c                       \ rS rSrS rSrg)BloomExtensionG   c                     SU l         g )Nbloomr   r>   s    r   r   BloomExtension.__init__H   s	    	r   r   NrD   rE   rF   rG   r   rL   r   r   r   rN   rN   G   s    r   rN   c                       \ rS rSrS rSrg)BtreeGinExtensionL   c                     SU l         g )N	btree_ginr   r>   s    r   r   BtreeGinExtension.__init__M   s	    	r   r   NrS   r   r   r   rU   rU   L   s     r   rU   c                       \ rS rSrS rSrg)BtreeGistExtensionQ   c                     SU l         g )N
btree_gistr   r>   s    r   r   BtreeGistExtension.__init__R   s	     	r   r   NrS   r   r   r   r[   r[   Q   s    !r   r[   c                       \ rS rSrS rSrg)CITextExtensionV   c                     SU l         g )Ncitextr   r>   s    r   r   CITextExtension.__init__W   	    	r   r   NrS   r   r   r   ra   ra   V       r   ra   c                       \ rS rSrS rSrg)CryptoExtension[   c                     SU l         g )Npgcryptor   r>   s    r   r   CryptoExtension.__init__\   	    	r   r   NrS   r   r   r   ri   ri   [       r   ri   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__a   rf   r   r   NrS   r   r   r   rq   rq   `   rg   r   rq   c                       \ rS rSrS rSrg)TrigramExtensione   c                     SU l         g )Npg_trgmr   r>   s    r   r   TrigramExtension.__init__f   s	    	r   r   NrS   r   r   r   rw   rw   e   s    r   rw   c                       \ rS rSrS rSrg)UnaccentExtensionj   c                     SU l         g )Nunaccentr   r>   s    r   r   UnaccentExtension.__init__k   rn   r   r   NrS   r   r   r   r}   r}   j   ro   r   r}   c                       \ rS rSrS rSrg)NotInTransactionMixino   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__rD   r   r/   s     r   _ensure_not_in_transaction0NotInTransactionMixin._ensure_not_in_transactionp   s;    ##33#9;?>>;R;RS  4r   r   N)rD   rE   rF   rG   r   rL   r   r   r   r   r   o   s    r   r   c                   F    \ rS rSrSrSr\R                  rS r	S r
S rSrg)	AddIndexConcurrentlyx   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/   r0   r1   models         r   r2   &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   r5   'AddIndexConcurrently.database_backwards   sd    ''6)))__E##M$<$<$B$BEJJ&&ujjt&L Kr   r   N)rD   rE   rF   rG   __doc__atomicr   rI   rJ   r?   r2   r5   rL   r   r   r   r   r   x   s&    NF ))H
JMr   r   c                   F    \ rS rSrSrSr\R                  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/   r0   r1   r   from_model_stater   s           r   r2   )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/   r0   r1   r   to_model_stater   s           r   r5   *RemoveIndexConcurrently.database_backwards   s    ''6''	??C##M$<$<$B$BEJJ%__Y8M8M-MNN"44TYY?E##Et#D Kr   r   N)rD   rE   rF   rG   r   r   r   REMOVALrJ   r?   r2   r5   rL   r   r   r   r   r      s'    LF ((H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   rF   )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)
rD   rE   rF   rG   r   r   r   r   r   rL   r   r   r   r   r      s     17t +


 
r   r   c                   R    \ rS rSrSr\R                  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   r2   !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   r5   "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   rB   'CreateCollation.migration_name_fragment       $tyy'888r   r   N)rD   rE   rF   rG   r   r   rI   rJ   r2   r5   r?   rK   rB   rL   r   r   r   r   r      s3     ))H--
/ 9 9r   r   c                   R    \ rS rSrSr\R                  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   r2   !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   r5   "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   rB   'RemoveCollation.migration_name_fragment  r   r   r   N)rD   rE   rF   rG   r   r   r   rJ   r2   r5   r?   rK   rB   rL   r   r   r   r   r      s3     ((H--
/ 9 9r   r   c                   f   ^  \ rS rSrSr\R                  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/   r0   r1   r   constraint_sqls          r   r2   '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   rB   )r   r   s    r   rB   -AddConstraintNotValid.migration_name_fragment)  s    w.==r   r   )rD   rE   rF   rG   r   r   rI   rJ   r   r?   r2   rK   rB   rL   __classcell__)r   s   @r   r   r   
  s9    
 !))H1
W > >r   r   c                   d    \ rS rSrSr\R                  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__3  s    $	r   c                 >    SU R                   < SU R                  < 3$ )NzValidate constraint r   r   r>   s    r   r?   ValidateConstraint.describe7  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   r2   $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   r5   %ValidateConstraint.database_backwardsE  s    r   c                     g r   r   r   s      r   r   !ValidateConstraint.state_forwardsI  r!   r   c                 t    U R                   R                  5       < SU R                  R                  5       < 3$ )N
_validate_)r   r   r   r>   s    r   rB   *ValidateConstraint.migration_name_fragmentL  s%    #'??#8#8#:DIIOO<MNNr   c                 b    U R                   R                  / U R                  U R                  S.4$ )Nr  )r   rD   r   r   r>   s    r   r   ValidateConstraint.deconstructP  s/    NN##"oo		
 	
r   r  N)rD   rE   rF   rG   r   r   
ALTERATIONrJ   r   r?   r2   r5   r   rK   rB   r   rL   r   r   r   r  r  .  sE    0 ++H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   r   django.db.models.constraintsr   r   rN   rU   r[   ra   ri   rq   rw   r}   r   r   r   r   r   r   r   r  r   r   r   <module>r     s    
 0 E E M 881i 81v_ 
   
! !
o 
o 
o 
 
 
 M0( M4E3[ E4)
 )
X9( 929( 92!>M !>H*
 *
r   