U
    {h                     @   sF   d dl mZ d dlmZmZ d dlmZ dd ZG dd dejZdS )	    )
migrations)CountMin)get_embed_hashc                 C   s   |  d}d}g }|j ddd D ]B}t|j|j|_|	| t
||kr*|j|dg |  q*|r|j|dg |jdjtdtddjdd	}|D ]&}|jj|d d
j|d d  qd S )Nzwagtailembeds.Embedi  idurl	max_widthhash)Z
hash_countmin_id   )Zhash_count__gt)r	   r
   )r   )Z	get_modelobjectsallonlyiteratorr   r   r   r	   appendlenZbulk_updateclearvaluesZannotater   r   filterexcludedelete)ZappsZschema_editorZEmbedZ
batch_sizebatchZembed
duplicatesdup r   t/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/embeds/migrations/0007_populate_hash.pymigrate_forwards   s(    


 r   c                   @   s$   e Zd ZdgZeeejjgZdS )	Migration)ZwagtailembedsZ0006_add_embed_hashN)	__name__
__module____qualname__dependenciesr   Z	RunPythonr   Znoop
operationsr   r   r   r   r   +   s   r   N)	Z	django.dbr   Zdjango.db.modelsr   r   Zwagtail.embeds.embedsr   r   r   r   r   r   r   <module>   s   $