+
    TjP                     |    ^ RI t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHt  ! R	 R
]4      tR# )    N)Decimal)Apps)NotSupportedError)BaseDatabaseSchemaEditor)	Statement)strip_quotes)CompositePrimaryKeyUniqueConstraintc                      a a ] tR t^t oRtRtRt]tRtRt	Rt
RtV 3R ltV 3R ltR tR	 tRR
 ltRV 3R lltV 3R ltV 3R ltRR ltR tV 3R ltV 3R ltR tRtVtV ;t# )DatabaseSchemaEditorzDROP TABLE %(table)sNzEREFERENCES %(to_table)s (%(to_column)s) DEFERRABLE INITIALLY DEFERREDz7CREATE UNIQUE INDEX %(name)s ON %(table)s (%(columns)s)zDROP INDEX %(name)sc                v   < V P                   P                  4       '       g   \        R 4      h\        SV `  4       # )zSQLite schema editor cannot be used while foreign key constraint checks are enabled. Make sure to disable them before entering a transaction.atomic() context because SQLite does not support disabling them in the middle of a multi-statement transaction.)
connectiondisable_constraint_checkingr   super	__enter__)self	__class__s   &V/var/www/idalgo/venv/lib/python3.14/site-packages/django/db/backends/sqlite3/schema.pyr   DatabaseSchemaEditor.__enter__   s:     ::<<#1  w ""    c                   < V P                   P                  4        \        SV `  WV4       V P                   P	                  4        R # N)r   check_constraintsr   __exit__enable_constraint_checking)r   exc_type	exc_value	tracebackr   s   &&&&r   r   DatabaseSchemaEditor.__exit__%   s2    ))+i8224r   c                2    ^ RI pVP                  V4      p\	        V\
        4      '       d   \        \        V4      4      # \	        V\        \        \        34      '       d   \        V4      # \	        V\        4      '       d   RVP                  RR4      ,          # Vf   R# \	        V\        \        \        34      '       d   RVP                  4       ,          # \        RV: R\!        V4      : 24      h  \         d     LXP                   d     Li ; i)	r   Nz'%s''z''NULLzX'%s'zCannot quote parameter value z	 of type )sqlite3adaptImportErrorProgrammingError
isinstanceboolstrintr   floatreplacebytes	bytearray
memoryviewhex
ValueErrortype)r   valuer#   s   && r   quote_value DatabaseSchemaEditor.quote_value*   s    	MM%(E eT""s5z?"455u:s##EMM#t444]y*=>> UYY[((@EtE{S '  	'' 		s   C6 6DDDDc                $    V P                  V4      # r   )r4   )r   r3   s   &&r   prepare_default$DatabaseSchemaEditor.prepare_defaultI   s    &&r   c                  a aa  V3R lpSP                   P                   Uu/ uF.  pVP                  V! V4      '       d   VP                  4       MTbK0  	  ppSP                   P                  p\        V\        4      '       d   VP                  4       WxP                  &   SP                   P                   Uu/ uF;  pVP                  RJ g   K  VP                  S P                  VP                  4      bK=  	  p	p/ p
RpT;'       g    . p\        VRR4      '       g;   \        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   \        VP                  4       4       F  w  o pVP                  '       g   K  \        ;QJ d    V 3R lV 4       F  '       g   K   RM	  RM! V 3R lV 4       4      '       d   K\  RVn        TpVP                  '       g   Ky  VS  WP                   K  	  V'       du   W'VP                  &   VP!                  4       '       gQ   VP                  '       g?   VP"                  '       d-   S P%                  S P'                  V4      4      WP                  &   V EFG  pVw  rVP)                  VP                  R4       V	P)                  VP                  R4       WVP                  &   VP                  WP                  &   VP                  '       d   Kz  VP*                  '       d   VP*                  '       g   VP!                  4       '       g"   S P%                  S P'                  V4      4      pMS P-                  V4      w  ppRR	S P                  VP                  4      R
V/,          pVWP                  &   EK   S P                  VP                  4      WP                  &   EKJ  	  V'       d   WsP                   V	P)                  VP                  R4       VP.                  '       dV   VP0                  P2                  P                   P                  '       d&   S P5                  VP0                  P2                  4      # \7        4       pSP                   P8                   UUu. uF%  pV Uu. uF  pV
P;                  VV4      NK  	  upNK'  	  pppSP                   P<                  pV'       d/   V Uu. uF"  pVP                  VP>                  9  g   K   VNK$  	  pp\        SP                   P@                  4      p\B        PD                  ! V4      pRSP                   PF                  RSP                   PH                  RVRVRVRV/p\K        RRV4      pVVR&   SPL                  VR&   \K        SP                   PN                  SPP                  V4       \B        PD                  ! V4      pRSP                   PF                  RR\S        SP                   PH                  4      ,          RVRVRVRV/p\K        RRV4      pVVR&   SPL                  VR&   \K        RSP                   PN                  ,          SPP                  V4      pV'       d   VPT                  VP                   P                  PT                  8X  dY   VP                   P                  p\W        VVPT                  4       VP                   PX                  P[                  V4       RVn        S P]                  V4       S P_                  RS P                  VP                   PH                  4      : RRPa                  V 3R lV	 4       4      : RRPa                  V	Pc                  4       4      : RS P                  SP                   PH                  4      : 24       S P5                  SRR7       S Pe                  VVP                   PH                  SP                   PH                  4       S Pf                   F  pS P_                  V4       K  	  . S n3        V'       d
   RVn        R# R# u upi u upi u upi u uppi u upi )a$  
Shortcut to transform a model from old_model into new_model

This follows the correct procedure to perform non-rename or column
addition operations based on SQLite's documentation

https://www.sqlite.org/lang_altertable.html#caution

The essential steps are:
  1. Create a table with the updated definition called "new__app_model"
  2. Copy the data from the existing "app_model" table to the new table
  3. Drop the "app_model" table
  4. Rename the "new__app_model" table to "app_model"
  5. Restore any index of the previous "app_model" table.
c                 \   < V P                   ;'       d    V P                  P                  SJ # r   )is_relationremote_fieldmodel)fr=   s   &r   is_self_referential?DatabaseSchemaEditor._remake_table.<locals>.is_self_referentialb   s$    ==BBQ^^%9%9U%BBr   FNprimary_keyc              3   @   "   T F  w  r\        VR R4      x  K  	  R# 5i)rA   FN)getattr).0_	new_fields   &  r   	<genexpr>5DatabaseSchemaEditor._remake_table.<locals>.<genexpr>~   s!      >
IUGI}e44s   Tc              3   F   <"   T F  w  rSVP                   8H  x  K  	  R # 5ir   )name)rD   rE   rF   rJ   s   &  r   rG   rH      s%      1 )5 INN*(4   !zcoalesce(%(col)s, %(default)s)coldefault	app_labeldb_tableunique_togetherindexesconstraintsappsMeta
__module__znew__%szNew%sINSERT INTO  (, c              3   F   <"   T F  pSP                  V4      x  K  	  R # 5ir   )
quote_name)rD   xr   s   & r   rG   rH      s     >g$//!,,grK   	) SELECT  FROM )handle_autom2m )4_metalocal_concrete_fieldsrJ   clonepkr'   r	   	generatedcolumnrZ   rC   anylistitemsrA   auto_createdhas_db_defaultconcreter7   effective_defaultpopnulldb_default_sqlmany_to_manyr<   throughdelete_modelr   rP   getrQ   fieldsrR   copydeepcopyrN   rO   r2   rU   object_name	__bases__r   attnamedelattrlocal_fieldsremovecreate_modelexecutejoinvaluesalter_db_tabledeferred_sql)!r   r=   create_fielddelete_fieldalter_fieldsr?   r>   bodyrc   mappingrename_mappingrestore_pk_fieldfieldalter_field	old_fieldrF   rM   rE   case_sqlrS   uniquenrP   rQ   indexrR   	body_copymeta_contentsmeta	new_modelauto_pksqlrJ   s!   ff&&&                           @r   _remake_table"DatabaseSchemaEditor._remake_tableL   s   ,	C [[66
6 FF!4Q!7!7AGGIQ>6 	 
 [[^^b-..HHJDM [[66
6{{e# 0AHHdooahh//6 	 
   #))r<66## >
IU>
### >
IU>
 ;
 ;
  $DJJL1e$$$SS 1 )5	1SSS 1 )5	1 . . ).E%',$))) J#LL1  2 &2""# !//11$... )))/3/C/C**<80++, (K#. IHHY^^T*KK	(($/#, -6^^N>>*"""~~~innn //11"2243I3I)3TUG!%!4!4Y!?JGQ;4??9+;+;<w?  -5((),0OOI<L<L,M(()' (* &&'KK++T2 ))) --55;;HHH(()B)B)J)JKKv  ++55
5 066v!^1%v65 	 

 ++%%#*#*%l.?.?u||.S7   5;;223
 MM$'	 ..,,w;D
 FB. 	&"'"2"2	,U[[$$eooyA MM$'	..	L1E1E$FFw;D
 FB. 	&"'"2"2	,5;;#:#::EOOYW	 L00IOO4F4F4N4NNoo((GIw/OO((//8IL 	)$ 	 	 8 89		>g>>		'..*+ 4 45	
 	%6 	OO$$KK  	
 $$CLL %+/( _

V 7
s;   `* `*8`/*`/	`9
`4%`9`?3`?4`9c                  < V'       d   \         SV `  V4       R# V P                  V P                  R V P	                  VP
                  P                  4      /,          4       \        V P                  4       Fc  p\        V\        4      '       g   K  VP                  VP
                  P                  4      '       g   KH  V P                  P                  V4       Ke  	  R# )tableN)r   rr   r~   sql_delete_tablerZ   r`   rO   rg   r   r'   r   references_tabler|   )r   r=   r^   r   r   s   &&& r   rr   !DatabaseSchemaEditor.delete_model  s    G ' LL%%T__U[[-A-AB D--.c9--#2F2FKK((3 3 %%,,S1	 /r   c                R  < ^ RI Hp VP                  '       dX   VP                  P                  P
                  P                  '       d(   V P                  VP                  P                  4       R# \        V\        4      '       d   R# VP                  '       gj   VP                  '       gX   VP                  '       dF   V P                  V4      f3   VP                  4       '       d1   \        VP                  V4      '       g   V P!                  WR7       R# \"        SV `I  W4       R# )zCreate a field on a model.)ValueN)r   )django.db.models.expressionsr   rp   r<   rq   r`   ri   r}   r'   r	   rA   r   rn   rl   rj   
db_defaultr   r   	add_field)r   r=   r   r   r   s   &&& r   r   DatabaseSchemaEditor.add_field*  s    6 %"4"4"<"<"B"B"O"O"Oe00889233
  |||::: %%e,8 $$&&z%:J:JE/R/Ru9Ge+r   c                r  < VP                   '       dZ   VP                  P                  P                  P                  '       d(   V P                  VP                  P                  4       R# R# V P                  P                  P                  '       dl   VP                  '       gZ   VP                  '       gH   VP                  '       g6   VP                  '       d   VP                  '       g   \        SV `9  W4       R# VP                  V P                  R7      R,          f   R# V P!                  WR7       R# )zm
Remove a field from a model. Usually involves deleting a column,
but for M2Ms may involve deleting a table.
)r   r2   N)r   )rp   r<   rq   r`   ri   rr   r   featurescan_alter_table_drop_columnrA   r   db_indexdb_constraintr   remove_fielddb_parametersr   )r   r=   r   r   s   &&&r   r   !DatabaseSchemaEditor.remove_fieldI  s     !!))//<<<!!%"4"4"<"<= = OO$$@@@ %%%LLLNNN'''E,?,?,?G . ""doo">vFNu9r   c	                \   VP                   VP                   8w  d   V P                  W4      V P                  W4      8X  d   VP                  '       d   VP                  '       g[   VP                  '       d   VP                  '       g7   V P	                  V P                  VP                  P                  W#V4      4      # V P                  WV3.R7       VP                  R4      p	VP                  R4      p
VP                  '       Ed   WE8w  g   W8w  Ed   \        4       pVP                  P                  pVP                   F  pVP                  V8X  d   K  VP                  '       g;   VP                   VP"                  8X  d   VP%                  VP                  4       K`  Kb  VP&                  '       g   Kv  VP(                  P                  P*                  '       g   K  VP%                  VP(                  4       K  	  VP&                  '       d~   VP                   Fm  pVP                  V8X  d   K  VP                  P(                  P                  P*                  '       g   KH  VP%                  VP                  P(                  4       Ko  	  V F  pV P                  V4       K  	  R# R# R# )z3Perform a "physical" (non-ManyToMany) field update.r   	collationN)re   
column_sqlr<   r   r~   _rename_field_sqlr`   rO   r   rs   r   setr=   related_objectsrelated_modelrp   
field_namerJ   addrA   rq   ri   )r   r=   r   rF   old_typenew_typeold_db_paramsnew_db_paramsstrictold_collationnew_collationrelated_modelsoptsr<   rp   r   s   &&&&&&&&&       r   _alter_field!DatabaseSchemaEditor._alter_fielde  s    	 0 001T__U5VV&&&+++)))+++ <<&&KK(()  	5I0F/GH%))+6%))+6 M$B UN??((D $ 4 4--6#000#..)..@&**<+E+EF A***|/C/C/I/I/V/V/V"&&|';';< !5 $$$$($5$5L $11U: #0088>>KKK&**<+D+D+L+LM %6 "0""=1 "0+ %C r   c                V   VP                   P                  P                  P                  VP                   P                  P                  P                  8X  Ed   V P	                  VP                   P                  VP                   P                  P                  P                  VP                  4       4      VP                   P                  P                  P                  VP                  4       4      3VP                   P                  P                  P                  VP                  4       4      VP                   P                  P                  P                  VP                  4       4      3.R7       R# V P                  VP                   P                  4       V P                  RV P                  VP                   P                  P                  P                  4      : RRP                  RVP                  4       VP                  4       .4      : RRP                  RVP                  4       VP                  4       .4      : RV P                  VP                   P                  P                  P                  4      : 24       V P                  VP                   P                  4       R# )	z*Alter M2Ms to repoint their to= endpoints.r   NrV   rW   rX   idr\   r]   )r<   rq   r`   rO   r   	get_fieldm2m_reverse_field_namem2m_field_namer}   r~   rZ   r   m2m_column_namem2m_reverse_namerr   )r   r=   r   rF   r   s   &&&&&r   _alter_many_to_many(DatabaseSchemaEditor._alter_many_to_many  s    ""**0099%%--33<<=
 &&.. "..66<<FF%<<> "..66<<FF%<<>
 "..66<<FF%446 "..66<<FF%446
  6  	)00889 	 6 6 > > D D M MN		!113!224 		!113!224 	 6 6 > > D D M MN#	
, 	)00889r   c                  < \        V\        4      '       dZ   VP                  '       g7   VP                  '       g%   VP                  '       g   VP
                  '       d   \        SV `  W4       R # V P                  V4       R # r   )	r'   r
   	conditioncontains_expressionsinclude
deferrabler   add_constraintr   r   r=   
constraintr   s   &&&r   r   #DatabaseSchemaEditor.add_constraint  s\    j"233   ...!!!$$$G"55u%r   c                  < \        V\        4      '       dZ   VP                  '       g7   VP                  '       g%   VP                  '       g   VP
                  '       d   \        SV `  W4       R # V P                  V4       R # r   )	r'   r
   r   r   r   r   r   remove_constraintr   r   s   &&&r   r   &DatabaseSchemaEditor.remove_constraint  s\    j"233   ...!!!$$$G%e8u%r   c                    R V,           # )zCOLLATE r_   )r   r   s   &&r   _collate_sql!DatabaseSchemaEditor._collate_sql  s    I%%r   )r   )NNN)T)F)__name__rU   __qualname____firstlineno__r   sql_create_fksql_create_inline_fksql_create_column_inline_fksql_create_uniquesql_delete_uniquesql_alter_table_commentsql_alter_column_commentr   r   r4   r7   r   rr   r   r   r   r   r   r   r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      s     -MO  #7Q-"##5
>'J0X2$,>:892v>:@	&	&& &r   r   )ru   decimalr   django.apps.registryr   	django.dbr   django.db.backends.base.schemar   !django.db.backends.ddl_referencesr   django.db.backends.utilsr   django.db.modelsr	   r
   r   r_   r   r   <module>r      s,      % ' C 7 1 Bk&3 k&r   