HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/db/migrations/__pycache__/recorder.cpython-310.pyc
o

�a�
�@sRddlmZddlmZmZddlmZddlmZddl	m
Z
Gdd�d�Zd	S)
�)�Apps)�
DatabaseError�models)�
classproperty)�now�)�MigrationSchemaMissingc@sdeZdZdZdZedd��Zdd�Zedd��Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�ZdS)�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.
    NcCs(|jdurGdd�dtj�}||_|jS)zl
        Lazy load to avoid AppRegistryNotReady if installed apps import
        MigrationRecorder.
        Nc@sFeZdZejdd�Zejdd�Zejed�Z	Gdd�d�Z
dd�ZdS)	z.MigrationRecorder.Migration.<locals>.Migration�)�
max_length)�defaultc@seZdZe�ZdZdZdS)z3MigrationRecorder.Migration.<locals>.Migration.Meta�
migrations�django_migrationsN)�__name__�
__module__�__qualname__r�apps�	app_label�db_table�rr�?/usr/lib/python3/dist-packages/django/db/migrations/recorder.py�Meta#srcSsd|j|jfS)NzMigration %s for %s)�name�app��selfrrr�__str__(sz6MigrationRecorder.Migration.<locals>.Migration.__str__N)rrrr�	CharFieldrr�
DateTimeFieldr�appliedrrrrrr�	Migrationsr )�_migration_classr�Model)�clsr rrrr s

zMigrationRecorder.MigrationcCs
||_dS�N)�
connection)rr%rrr�__init__.s
zMigrationRecorder.__init__cCs|jj�|jj�Sr$)r �objects�usingr%�aliasrrrr�migration_qs1�zMigrationRecorder.migration_qscCsF|j���}|jj�|�}Wd�n1swY|jjj|vS)z2Return True if the django_migrations table exists.N)r%�cursor�
introspection�table_namesr �_metar)rr,�tablesrrr�	has_table5s�zMigrationRecorder.has_tablec
Csr|��rdSz |j���}|�|j�Wd�WdS1swYWdSty8}ztd|��d}~ww)z3Ensure the table exists and has the correct schema.Nz1Unable to create the django_migrations table (%s))r1r%�
schema_editor�create_modelr rr)r�editor�excrrr�
ensure_schema;s&���zMigrationRecorder.ensure_schemacCs|��rdd�|jD�SiS)z}
        Return a dict mapping (app_name, migration_name) to Migration instances
        for all applied migrations.
        cSsi|]	}|j|jf|�qSr�rr)�.0�	migrationrrr�
<dictcomp>Nsz8MigrationRecorder.applied_migrations.<locals>.<dictcomp>)r1r*rrrr�applied_migrationsHsz$MigrationRecorder.applied_migrationscCs|��|jj||d�dS)z$Record that a migration was applied.r7N)r6r*�create�rrrrrr�record_appliedTsz MigrationRecorder.record_appliedcCs |��|jj||d���dS)z&Record that a migration was unapplied.r7N)r6r*�filter�deleter=rrr�record_unappliedYsz"MigrationRecorder.record_unappliedcCs|j����dS)z<Delete all migration records. Useful for testing migrations.N)r*�allr@rrrr�flush^r+zMigrationRecorder.flush)rrr�__doc__r!rr r&�propertyr*r1r6r;r>rArCrrrrr		s


r	N)�django.apps.registryr�	django.dbrr�django.utils.functionalr�django.utils.timezoner�
exceptionsrr	rrrr�<module>s