§
    kÍâhü  ã                   ó²   — d dl Z d dlmZ d dlmZ d dlmZ d dlmZm	Z	 d dl
mZmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ dZdZ G d„ de¦  «        ZdS )é    N)Ú
itemgetter)ÚPath)Úcall_command)ÚBaseCommandÚCommandError)ÚDEFAULT_DB_ALIASÚconnections)ÚBaseDatabaseWrapper)ÚMigrationLoader)ÚMigrationRecorder)Útimezone)Úsignalcommandzmanagestate.jsonÚdefaultc                   óÌ   — e Zd ZU dZdZeed<   eed<   eed<   eed<   eed<   e	ed<   d	„ Z
ed
„ ¦   «         Zdefd„Zdefd„Zdefd„Zdefd„Zdededefd„Zdefd„Zdefd„ZdS )ÚCommandz,Manage database state in the convenient way.NÚmigrate_argsÚmigrate_optionsÚfilenameÚ	verbosityÚdatabaseÚconnc                 óF  — |                      ddd¬¦  «         |                      ddt          dt          › d�¬	¦  «         |                      d
dt          dt          › d�¬¦  «         |                      ddt          dt          › d�¬¦  «         |                      ddddd¬¦  «         |                      ddd¬¦  «         |                      ddd¬¦  «         |                      ddd¬¦  «         |                      d dd!¬¦  «         |                      d"dd#d$¬¦  «         d S )%NÚaction)ÚdumpÚloadztAn action to do. Dump action saves applied migrations to a file. Load action applies migrations specified in a file.)ÚchoicesÚhelpÚstateú?z?A name of a state. Usually a name of a git branch.Defaults to "ú")Únargsr   r   z-dz
--databasez6Nominates a database to synchronize. Defaults to the "z" database.)r   r   z-fz
--filenamez!A file to write to. Defaults to "z	--noinputz
--no-inputÚstore_falseÚinteractivez^The argument for "migrate" command. Tells Django to NOT prompt the user for input of any kind.)r   Údestr   z--fakeÚ
store_truezYThe argument for "migrate" command. Mark migrations as run without actually running them.)r   r   z--fake-initiala   The argument for "migrate" command. Detect if tables already exist and fake-apply initial migrations if so. Make sure that the current database schema matches your initial migration before using this flag. Django will only check for an existing table name.z--planzaThe argument for "migrate" command. Shows a list of the migration actions that will be performed.z--run-syncdbzOThe argument for "migrate" command. Creates tables for apps without migrations.z--checkÚcheck_unappliedz_The argument for "migrate" command. Exits with a non-zero status if unapplied migrations exist.)Úadd_argumentÚDEFAULT_STATEr   ÚDEFAULT_FILENAME)ÚselfÚparsers     úh/var/www/histauto/venv/lib/python3.11/site-packages/django_extensions/management/commands/managestate.pyÚadd_argumentszCommand.add_arguments   sô  € Ø×ÒØØ$ðBð 	ñ 	
ô 	
ð 	
ð 	×ÒØØÝ!ð-Ý)ð-ð -ð -ð	 	ñ 	
ô 	
ð 	
ð 	×ÒØØÝ$ð>Ý 0ð>ð >ð >ð	 	ñ 	
ô 	
ð 	
ð 	×ÒØØÝ$ØHÕ5EÐHÐHÐHð	 	ñ 	
ô 	
ð 	
ð 	×ÒØØØ ØðIð 	ñ 	
ô 	
ð 	
ð 	×ÒØØðDð 	ñ 	
ô 	
ð 	
ð 	×ÒØØðAð 	ñ 	
ô 	
ð 	
ð 	×ÒØØðLð 	ñ 	
ô 	
ð 	
ð 	×ÒØØð:ð 	ñ 	
ô 	
ð 	
ð 	×ÒØØØ"ðJð	 	ñ 	
ô 	
ð 	
ð 	
ð 	
ó    c                 ó®   — || _         || _        |d         | _        t          |         | _        || _        || _         t          | |¦  «        |¦  «         d S )Nr   )r   r   r   r	   r   r   r   Úgetattr)r*   r   r   r   r   ÚargsÚoptionss          r,   ÚhandlezCommand.handleg   sX   € à ˆÔØ&ˆÔØ  Ô-ˆŒÝ Ô)ˆŒ	Ø ˆŒØ ˆŒØ���fÑÔ˜eÑ$Ô$Ð$Ð$Ð$r.   r   c           	      ó&  — |                       ¦   «         }|                     |                      ¦   «         ¦  «         |                      ||i¦  «         | j                             | j                             d|› d| j        › d�¦  «        ¦  «         dS )z"Save applied migrations to a file.zMigrations for state "z"" have been successfully saved to ú.N)Úget_migrated_appsÚupdateÚget_applied_migrationsÚwriteÚstdoutÚstyleÚSUCCESSr   )r*   r   Úmigrated_appss      r,   r   zCommand.dumpq   s¨   € à×.Ò.Ñ0Ô0ˆØ×Ò˜T×8Ò8Ñ:Ô:Ñ;Ô;Ð;Ø�
Š
�E˜=Ð)Ñ*Ô*Ð*ØŒ×ÒØŒJ×Òð-¨ð -ð -Ø œMð-ð -ð -ñô ñ	
ô 	
ð 	
ð 	
ð 	
r.   c                 óT  — |                       ¦   «                              |¦  «        }|€t          d|› �¦  «        ‚i | j        ¥| j        | j        dk    r
| j        dz
  nddœ¥}|                     ¦   «         D ]y\  }}|                      ||¦  «        rŒ| j        dk    r6| j         	                    | j
                             d|› d�¦  «        ¦  «         ||g| j        ¢R }t          dg|¢R i |¤Ž Œz| j         	                    | j
                             d	|› d
�¦  «        ¦  «         dS )zApply migrations from a file.NzNo such state saved: é   r   )r   r   zApplying migrations for "r    ÚmigrateúMigrations for "z!" have been successfully applied.)ÚreadÚgetr   r   r   r   ÚitemsÚ
is_appliedr:   r9   r;   ÚWARNINGr   r   r<   )r*   r   Ú
migrationsÚkwargsÚappÚ	migrationr1   s          r,   r   zCommand.load}   sx  € à—Y’Y‘[”[—_’_ UÑ+Ô+ˆ
ØÐÝÐ>°uÐ>Ð>Ñ?Ô?Ð?ð
ØÔ"ð
àœØ/3¬~ÀÒ/AÐ/A˜œ¨!Ñ+Ð+Àqð
ð 
ð 
ˆð )×.Ò.Ñ0Ô0ð 		5ð 		5‰NˆC�Ø�Š˜s IÑ.Ô.ð ØàŒ~ Ò!Ð!Ø”×!Ò!Ø”J×&Ò&Ð'IÀ3Ð'IÐ'IÐ'IÑJÔJñô ð ð ˜Ð7 TÔ%6Ð7Ð7ˆDÝ˜Ð4 TÐ4Ð4Ð4¨VÐ4Ð4Ð4Ð4àŒ×ÒØŒJ×ÒØK 5ÐKÐKÐKñô ñ	
ô 	
ð 	
ð 	
ð 	
r.   Úreturnc                 óþ   — t          | j        ¦  «        j        }t                               |d¦  «        }| j        dk    r=| j                             dd                     t          |¦  «        ¦  «        z   ¦  «         |S )z!Installed apps having migrations.Úzeror?   zApps having migrations: z, )
r   r   r=   ÚdictÚfromkeysr   r:   r9   ÚjoinÚsorted)r*   Úappsr=   s      r,   r6   zCommand.get_migrated_appsš   sr   € å˜tœyÑ)Ô)Ô7ˆÝŸš d¨FÑ3Ô3ˆØŒ>˜AÒÐØŒK×ÒØ*¨T¯YªYµv¸mÑ7LÔ7LÑ-MÔ-MÑMñô ð ð Ðr.   c                 ó   — | j         r| j         S t          | j        ¦  «                             ¦   «         }t	          |                     ¦   «         t          d¦  «        ¬¦  «        }t          |¦  «        | _         | j         S )z,Installed apps with last applied migrations.r?   )Úkey)Ú_applied_migrationsr   r   Úapplied_migrationsrQ   Úkeysr   rN   )r*   rG   Úlast_applieds      r,   r8   zCommand.get_applied_migrations¤   sl   € àÔ#ð 	,ØÔ+Ð+å& t¤yÑ1Ô1×DÒDÑFÔFˆ
Ý˜jŸošoÑ/Ô/µZÀ±]´]ÐCÑCÔCˆå#'¨Ñ#5Ô#5ˆÔ ØÔ'Ð'r.   rI   rJ   c                 óæ   — |                       ¦   «                              |¦  «        }||k    rC| j        dk    r6| j                             | j                             d|› d�¦  «        ¦  «         dS dS )z7Check whether a migration for an app is applied or not.r?   rA   z" are already applied.TF)r8   rC   r   r:   r9   r;   rF   )r*   rI   rJ   Úapplieds       r,   rE   zCommand.is_applied¯   s~   € à×-Ò-Ñ/Ô/×3Ò3°CÑ8Ô8ˆØ�iÒÐØŒ~ Ò!Ð!Ø”×!Ò!Ø”J×&Ò&Ð'U¸#Ð'UÐ'UÐ'UÑVÔVñô ð ð �4Øˆur.   c                 ó,  — t          | j        ¦  «        }|                     ¦   «         r|                     ¦   «         st	          d| j        › �¦  «        ‚t          | j        ¦  «        5 }t          j        |¦  «        cddd¦  «         S # 1 swxY w Y   dS )zGet saved state from the file.zNo such file: N)r   r   ÚexistsÚis_filer   ÚopenÚjsonr   )r*   ÚpathÚfiles      r,   rB   zCommand.readº   sÇ   € å�D”MÑ"Ô"ˆØ�{Š{‰}Œ}ð 	A D§L¢L¡N¤Nð 	AÝÐ?°´Ð?Ð?Ñ@Ô@Ð@å�$”-Ñ Ô ð 	# DÝ”9˜T‘?”?ð	#ð 	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s   Á(B	Â	BÂBÚdatac                 óL  — 	 |                       ¦   «         }n# t          $ r i }Y nw xY w|                     |t          t	          j        ¦   «         ¦  «        ¬¦  «         t          | j        d¦  «        5 }t          j	        ||dd¬¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z.Write new data to the file using existent one.)Ú
updated_atÚwé   T)ÚindentÚ	sort_keysN)
rB   r   r7   Ústrr   Únowr^   r   r_   r   )r*   rb   Úsavedra   s       r,   r9   zCommand.writeÃ   sì   € ð	Ø—I’I‘K”KˆEˆEøÝð 	ð 	ð 	ØˆEˆEˆEð	øøøð 	�Š�T¥c­(¬,©.¬.Ñ&9Ô&9ˆÑ:Ô:Ð:Ý�$”- Ñ%Ô%ð 	=¨ÝŒI�e˜T¨!°tÐ<Ñ<Ô<Ð<ð	=ð 	=ð 	=ñ 	=ô 	=ð 	=ð 	=ð 	=ð 	=ð 	=ð 	=ð 	=øøøð 	=ð 	=ð 	=ð 	=ð 	=ð 	=s   ‚ —&¥&Á3BÂBÂ B)Ú__name__Ú
__module__Ú__qualname__r   rU   rN   Ú__annotations__ri   Úintr
   r-   r   r3   r   r   r6   r8   ÚboolrE   rB   r9   © r.   r,   r   r      sY  € € € € € € Ø9€DØÐØÐÐÑØÐÐÑØ€M€M�MØ€N€N�NØ€M€M�MØ
ÐÐÑðG
ð G
ð G
ðR ð%ð %ñ „]ð%ð

˜#ð 

ð 

ð 

ð 

ð
˜#ð 
ð 
ð 
ð 
ð: 4ð ð ð ð ð	(¨ð 	(ð 	(ð 	(ð 	(ð	˜cð 	¨cð 	°dð 	ð 	ð 	ð 	ð#�dð #ð #ð #ð #ð	=˜$ð 	=ð 	=ð 	=ð 	=ð 	=ð 	=r.   r   )r_   Úoperatorr   Úpathlibr   Údjango.core.managementr   Údjango.core.management.baser   r   Ú	django.dbr   r	   Údjango.db.backends.base.baser
   Údjango.db.migrations.loaderr   Údjango.db.migrations.recorderr   Údjango.utilsr   Ú"django_extensions.management.utilsr   r)   r(   r   rr   r.   r,   ú<module>r}      s  ðà €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à /Ð /Ð /Ð /Ð /Ð /Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ AØ 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø <Ð <Ð <Ð <Ð <Ð <Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø !Ð !Ð !Ð !Ð !Ð !à <Ð <Ð <Ð <Ð <Ð <à%Ð Ø€ðx=ð x=ð x=ð x=ð x=ˆkñ x=ô x=ð x=ð x=ð x=r.   