Ë
    ¹ûàgó  ã                   óX   — d dl mZ d dlmZmZ d dlmZ d dlmZ ddl	m
Z
  G d„ d«      Zy	)
é    )ÚApps)ÚDatabaseErrorÚmodels)Úclassproperty)Únowé   )ÚMigrationSchemaMissingc                   ó^   — e Zd ZdZdZed„ «       Zd„ Zed„ «       Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zy)ÚMigrationRecorderaÖ  
    Deal with storing migration records in the database.

    Because this table is actually itself used for dealing with model
    creation, it's the one thing we can't do normally via migrations.
    We manually handle table creation/schema updating (using schema backend)
    and then have a floating model to do queries with.

    If a migration is unapplied its row is removed from the table. Having
    a row in the table always means a migration is applied.
    Nc                 ór   — | j                   €  G d„ dt        j                  «      }|| _         | j                   S )zl
        Lazy load to avoid AppRegistryNotReady if installed apps import
        MigrationRecorder.
        c                   ó˜   — e Zd Z ej                  d¬«      Z ej                  d¬«      Z ej                  e¬«      Z	 G d„ d«      Z
d„ Zy)ú.MigrationRecorder.Migration.<locals>.Migrationéÿ   )Ú
max_length)Údefaultc                   ó"   — e Zd Z e«       ZdZdZy)ú3MigrationRecorder.Migration.<locals>.Migration.MetaÚ
migrationsÚdjango_migrationsN)Ú__name__Ú
__module__Ú__qualname__r   ÚappsÚ	app_labelÚdb_table© ó    ú[/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django/db/migrations/recorder.pyÚMetar   %   s   „ Ù›6�DØ ,�IØ2‘Hr   r   c                 ó:   — d| j                   ›d| j                  ›�S )Nz
Migration z for )ÚnameÚapp©Úselfs    r   Ú__str__z6MigrationRecorder.Migration.<locals>.Migration.__str__*   s   � Ø48·I³I¸t¿xºxÐHÐHr   N)r   r   r   r   Ú	CharFieldr"   r!   ÚDateTimeFieldr   Úappliedr   r%   r   r   r   Ú	Migrationr       sH   „ Ø&�f×&Ñ&°#Ô6�Ø'�v×'Ñ'°3Ô7�Ø.˜&×.Ñ.°sÔ;�÷3ñ 3ó
Ir   r)   )Ú_migration_classr   ÚModel)Úclsr)   s     r   r)   zMigrationRecorder.Migration   s8   € ð ×ÑÐ'ôIœFŸL™Lô Ið $-ˆCÔ Ø×#Ñ#Ð#r   c                 ó    — || _         d| _        y )NF)Ú
connectionÚ
_has_table)r$   r.   s     r   Ú__init__zMigrationRecorder.__init__0   s   € Ø$ˆŒØˆ�r   c                 ót   — | j                   j                  j                  | j                  j                  «      S )N)r)   ÚobjectsÚusingr.   Úaliasr#   s    r   Úmigration_qszMigrationRecorder.migration_qs4   s'   € à�~‰~×%Ñ%×+Ñ+¨D¯O©O×,AÑ,AÓBÐBr   c                 ó*  — | j                   ry| j                  j                  «       5 }| j                  j                  j	                  |«      }ddd«       | j
                  j                  j                  v | _         | j                   S # 1 sw Y   Œ<xY w)z2Return True if the django_migrations table exists.TN)r/   r.   ÚcursorÚintrospectionÚtable_namesr)   Ú_metar   )r$   r7   Útabless      r   Ú	has_tablezMigrationRecorder.has_table8   s{   € ð �?Š?Øà�_‰_×#Ñ#Ó%ð 	G¨Ø—_‘_×2Ñ2×>Ñ>¸vÓFˆF÷	Gð Ÿ.™.×.Ñ.×7Ñ7¸6ÐAˆŒØ�‰Ð÷		Gð 	Gús   ¨&B	Â	Bc                 óú   — | j                  «       ry	 | j                  j                  «       5 }|j                  | j                  «       ddd«       y# 1 sw Y   yxY w# t
        $ r}t        d|z  «      ‚d}~ww xY w)z3Ensure the table exists and has the correct schema.Nz1Unable to create the django_migrations table (%s))r<   r.   Úschema_editorÚcreate_modelr)   r   r	   )r$   ÚeditorÚexcs      r   Úensure_schemazMigrationRecorder.ensure_schemaE   ss   € ð �>‰>ÔØð	Ø—‘×.Ñ.Ó0ð 4°FØ×#Ñ# D§N¡NÔ3÷4÷ 4ñ 4ûäò 	Ü(ØCÀcÑIóð ûð	ús4   “A ­AÁ	A ÁAÁA ÁA Á	A:Á'A5Á5A:c                 ó’   — | j                  «       r1| j                  D �ci c]  }|j                  |j                  f|“Œ c}S i S c c}w )z}
        Return a dict mapping (app_name, migration_name) to Migration instances
        for all applied migrations.
        )r<   r5   r"   r!   )r$   Ú	migrations     r   Úapplied_migrationsz$MigrationRecorder.applied_migrationsT   sO   € ð
 �>‰>Ôð "&×!2Ñ!2öàð —‘ 	§¡Ð/°Ñ:òð ð ˆIùòs   Ÿ Ac                 ó^   — | j                  «        | j                  j                  ||¬«       y)z$Record that a migration was applied.©r"   r!   N)rB   r5   Úcreate©r$   r"   r!   s      r   Úrecord_appliedz MigrationRecorder.record_appliedc   s'   € à×ÑÔØ×Ñ× Ñ  S¨tÐ Õ4r   c                 óz   — | j                  «        | j                  j                  ||¬«      j                  «        y)z&Record that a migration was unapplied.rG   N)rB   r5   ÚfilterÚdeleterI   s      r   Úrecord_unappliedz"MigrationRecorder.record_unappliedh   s0   € à×ÑÔØ×Ñ× Ñ  S¨tÐ Ó4×;Ñ;Õ=r   c                 óT   — | j                   j                  «       j                  «        y)z<Delete all migration records. Useful for testing migrations.N)r5   ÚallrM   r#   s    r   ÚflushzMigrationRecorder.flushm   s   € à×Ñ×ÑÓ×&Ñ&Õ(r   )r   r   r   Ú__doc__r*   r   r)   r0   Úpropertyr5   r<   rB   rE   rJ   rN   rQ   r   r   r   r   r   	   sZ   „ ñ
ð Ðàñ$ó ð$ò. ð ñCó ðCòòòò5ò
>ó
)r   r   N)Údjango.apps.registryr   Ú	django.dbr   r   Údjango.utils.functionalr   Údjango.utils.timezoner   Ú
exceptionsr	   r   r   r   r   ú<module>rY      s    ðÝ %ß +Ý 1Ý %å .÷f)ò f)r   