
    LȂi                     V    S SK Jr  S SKJrJr  S SKJrJr  S SKJ	r	J
r
   " S S\5      rg)    )apps)BaseCommandCommandError)DEFAULT_DB_ALIASconnections)AmbiguityErrorMigrationLoaderc                   <   ^  \ rS rSrSrSrS rU 4S jrS rSr	U =r
$ )Command   z2Prints the SQL statements for the named migration.Tc                     UR                  SSS9  UR                  SSS9  UR                  S[        [        [        5      SS9  UR                  S	S
SS9  g )N	app_labelz6App label of the application containing the migration.)helpmigration_namez$Migration name to print the SQL for.z
--databasezKNominates a database to create SQL for. Defaults to the "default" database.)defaultchoicesr   z--backwards
store_truez=Creates SQL to unapply the migration, rather than to apply it)actionr   )add_argumentr   tupler   )selfparsers     [D:\sksbv-state-backend\venv\Lib\site-packages\django/core/management/commands/sqlmigrate.pyadd_argumentsCommand.add_arguments   s|    V 	 	
 	#I 	 	
 	$+& 	 	
 	P 	 	
    c                 H   > S U R                   l        [        TU ]  " U0 UD6$ )Nc                     U $ )N )noops    r   <lambda>!Command.execute.<locals>.<lambda>%   s    dr   )styleSQL_KEYWORDsuperexecute)r   argsoptions	__class__s      r   r&   Command.execute"   s%     "3

w000r   c                    [         US      n[        USS9nUS   US   pe [        R                  " U5        XTR                  ;  a  [        SU-  5      e UR                  XV5      nXXR                  4n	UR                  =(       a    UR                  R                  U l        UR                   R"                  U	   US   4/n
UR%                  U
5      nU(       d$  US   S:  a  U R&                  R)                  S5        SR+                  U5      $ ! [         a  n[        [        U5      5      eS nAff = f! [         a    [        SU< SU< S	35      e[         a    [        S
U< SU< S35      ef = f)NdatabaseF)replace_migrationsr   r   z!App '%s' does not have migrationsz!More than one migration matches 'z
' in app 'z'. Please be more specific.z"Cannot find a migration matching 'z' from app 'z'. Is it in INSTALLED_APPS?	backwards	verbosity   zNo operations found.
)r   r	   r   get_app_configLookupErrorr   strmigrated_appsget_migration_by_prefixr   KeyErrornameatomicfeaturescan_rollback_ddloutput_transactiongraphnodescollect_sqlstderrwritejoin)r   r'   r(   
connectionloaderr   r   err	migrationtargetplansql_statementss               r   handleCommand.handle(   sz    !45
 !F %,K$8'BR:S>	)	* 000BYNOO	66yQI ^^,
 E!4!4!E!E 	 ##F+W[-ABC++D1'+"6!";KK45yy((=  	)s3x((	)  	-y:   	%3Y@ 	s#   D D3 
D0D++D03<E/)r<   )__name__
__module____qualname____firstlineno__r   r<   r   r&   rJ   __static_attributes____classcell__)r)   s   @r   r   r      s"    ?D
,1+) +)r   r   N)django.appsr   django.core.management.baser   r   	django.dbr   r   django.db.migrations.loaderr   r	   r   r   r   r   <module>rV      s     A 3 GL)k L)r   