Ë
    qûàg+  ã                   ór   — d Z ddl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  G d	„ d
e«      Zy)z°
Recreates the public schema for current database (PostgreSQL only).
Useful for Docker environments where you need to reset database
schema while there are active connections.
é    N)ÚBaseCommandÚCommandError)ÚDEFAULT_DB_ALIAS)Úconnections)Úsettings)ÚPOSTGRESQL_ENGINES)ÚRemovedInNextVersionWarningc                   ó,   ‡ — e Zd ZdZdZˆ fd„Zd„ Zˆ xZS )ÚCommandz&`reset_schema` command implementation.z-Recreates the public schema for this project.c                 óô   •— t         ‰| �  |«       |j                  dddddd¬«       |j                  dd	d
dt        d¬«       |j                  dt        dt        z  ¬«       |j                  ddd
ddd¬«       y )Nz	--noinputz
--no-inputÚstore_falseÚinteractiveTz:Tells Django to NOT prompt the user for input of any kind.)ÚactionÚdestÚdefaultÚhelpz-Rz--routerÚstoreÚrouterzBUse this router-database instead of the one defined in settings.pyz
--databasezGNominates a database to run command for. Defaults to the "%s" database.)r   r   z-Sz--schemaÚschemaÚpublicz$Drop this schema instead of "public")ÚsuperÚadd_argumentsÚadd_argumentr   )ÚselfÚparserÚ	__class__s     €úp/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django_extensions/management/commands/reset_schema.pyr   zCommand.add_arguments   s�   ø€ Ü‰Ñ˜fÔ%Ø×ÑØ˜¨mØ¨ØMð 	ô 	
ð
 	×ÑØ�* W°8ÔEUØUð 	ô 	
ð 	×ÑØÔ"2ØZÔ]mÑmð 	ô 	
ð 	×ÑØ�* W°8ÀXØ7ð 	õ 	
ó    c                 ób  — |d   }|d   t         k7  r!t        j                  dt        d¬«       |d   }t        j
                  j                  |«      }|€t        d|z  «      ‚|j                  d«      }|t        vrt        d«      ‚|d	   }|d
   }|d   rt        dj                  ||«      «      }nd}|dk7  rt        d«       y t        |   j                  «       5 }	|	j                  dj                  |«      «       |	j                  dj                  |«      «       d d d «       y # 1 sw Y   y xY w)NÚdatabaser   z2--router is deprecated. You should use --database.é   )Ú
stacklevelzUnknown database %sÚENGINEz8This command can be used only with PostgreSQL databases.ÚNAMEr   r   zÈ
You have requested a database schema reset.
This will IRREVERSIBLY DESTROY ALL data
in the "{}" schema of database "{}".
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: ÚyeszReset cancelled.zDROP SCHEMA {} CASCADEzCREATE SCHEMA {})r   ÚwarningsÚwarnr	   r   Ú	DATABASESÚgetr   r   ÚinputÚformatÚprintr   ÚcursorÚexecute)
r   ÚargsÚoptionsr    ÚdbinfoÚengineÚdatabase_namer   Úconfirmr-   s
             r   ÚhandlezCommand.handle,   s2  € Ø˜:Ñ&ˆØ�8ÑÔ 0Ò0Ü�M‰MÐNÔPkÐxyÕzØ˜xÑ(ˆHä×#Ñ#×'Ñ'¨Ó1ˆØˆ>ÜÐ4°xÑ?Ó@Ð@à—‘˜HÓ%ˆØÔ+Ñ+ÜÐYÓZÐZà˜v™ˆà˜Ñ"ˆà�=Ò!Üð /÷ 06©v°f¸mÓ/LóN‰Gð ˆGà�eÒÜÐ$Ô%Øä˜Ñ"×)Ñ)Ó+ð 	>¨vØ�N‰NÐ3×:Ñ:¸6ÓBÔCØ�N‰NÐ-×4Ñ4°VÓ<Ô=÷	>÷ 	>ñ 	>ús   ÃAD%Ä%D.)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r5   Ú__classcell__)r   s   @r   r   r      s   ø„ Ù0à:€Dô
ö(#>r   r   )r9   r&   Údjango.core.managementr   r   Ú	django.dbr   r   Údjango.confr   Údjango_extensions.settingsr   Ú#django_extensions.utils.deprecationr	   r   © r   r   ú<module>rA      s-   ðñó ç <Ý &Ý !Ý  å 9Ý Kô<>ˆkõ <>r   