o
    gQ                     @   s   U d Z ddlmZmZ ddlmZ ddlZdZe	e
d< dZee	df e
d< dZee	ee	 df e
d	< dZee	ee	 df e
d
< dd Zdd ZdS )zDrop users.total_points, drop rewards/reward_redemptions and update transaction_type enum in point_transactions

Revision ID: 5101c3bd185a
Revises: b61c52e24249
Create Date: 2025-02-21 16:08:25.294712

    )SequenceUnion)opNZ5101c3bd185arevisionZb61c52e24249down_revisionbranch_labels
depends_onc                   C   s6   t d t d t d t d t d d S )NzALTER TABLE point_transactions MODIFY COLUMN transaction_type ENUM('step', 'referral', 'referral_bonus', 'redeem', 'admin_adjust', 'etc') NOT NULLzaUPDATE point_transactions SET transaction_type='referral_bonus' WHERE transaction_type='referral'zALTER TABLE point_transactions MODIFY COLUMN transaction_type ENUM('step', 'achievement', 'referral_bonus', 'referral_chain', 'redeem', 'admin_adjust', 'etc') NOT NULLreward_redemptionsrewards)r   execute
drop_table r   r   K/app/alembic/versions/5101c3bd185a_drop_users_total_points_drop_rewards_.pyupgrade   s   
r   c                   C   sP  t d t dtjdtjdddddtjdtdd	d
tjdtjdd
tjdtjd	d
tjdtddd
tjdtjd	ddtjdtj	d	tj
 dtjdtj	d	tj
 tj
 d	 t dtjdtjdddddtjdtjddtjdddd	d
tjdtjddtjdddd	d
tjdtjd	d
tjdtj	d	tj
 d d S )NzALTER TABLE point_transactions MODIFY COLUMN transaction_type ENUM('step', 'referral', 'redeem', 'admin_adjust', 'etc') NOT NULLr
   idT)unsigned)primary_keyautoincrementreward_named   F)nullabledescriptionpoints_requiredcountry_code   active1)r   server_default
created_at
updated_at)r   r   onupdater	   user_idzusers.idCASCADE)ondelete	reward_idz
rewards.idpoints_spent)r   r   create_tablesaColumn
BigIntegerStringTextIntegerDateTimefuncnow
ForeignKeyr   r   r   r   	downgrade/   s,    ""r1   )__doc__typingr   r   alembicr   
sqlalchemyr'   r   str__annotations__r   r   r   r   r1   r   r   r   r   <module>   s    