
    Wj)                     8    d Z ddlmZ ddlZdZdZdZdZd Z	d Z
y)u|   Initial schema — Phase 1 models and indexes

Revision ID: e46c47c38302
Revises: 
Create Date: 2026-05-27 07:12:00.808546

    )opNe46c47c38302c                  8$   t        j                  dt        j                  dt        j                         d      t        j                  dt        j
                  d      d      t        j                  dt        j
                  d	      d      t        j                  d
t        j
                  d      d      t        j                  dt        j                         d      t        j                  dt        j                  dd      d      t        j                  dt        j                  dd      d      t        j                  dt        j                  dd      d      t        j                  dt        j                  dd      d      t        j                  dt        j                         t        j                  d      d      t        j                  d             t        j                  dt        j                  dt        j                         d      t        j                  dt        j
                  d      d      t        j                  dt        j                         d      t        j                  dt        j                         d      t        j                  d      t        j                  dd             t        j                  dt        j                  dt        j                         d      t        j                  dt        j
                  d      d      t        j                  dt        j                  dd      d      t        j                  dt        j                  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                  d!t        j                  dt        j                         d      t        j                  d"t        j
                  d#      d      t        j                  d$t        j                         t        j                  d      d      t        j                  d%t        j
                  d	      d      t        j                  d&t        j                         d      t        j                  d't        j                         d      t        j                  d             t        j                  d(t        j                  dt        j                         d      t        j                  d)t        j
                  d*      d      t        j                  d+t        j                  dd      d      t        j                  d%t        j
                  d	      d      t        j                  d,t        j                         d      t        j                  d-t        j                         d      t        j                  dt        j                         t        j                  d      d      t        j                  d      	       t        j                  d.t        j                  dt        j                         d      t        j                  d/t        j                  dd      d      t        j                  d             t        j                  d0t        j                  dt        j                         d      t        j                  dt        j
                  d      d      t        j                  d1t        j                  dd      d      t        j                  d2t        j                         d      t        j                  d t        j                         d      t        j                  d3t        j
                  d      d      t        j                  dt        j                         d      t        j                  d4t        j                         d      t        j                  d4gd5gd67      t        j                  d             t        j                  d0d 8      5 } | j                  d9d gd:       d d d        t        j                  d;t        j                  dt        j                         d      t        j                  d<t        j                         d      t        j                  d=t        j                         d      t        j                  d1t        j                  dd      d      t        j                  d4t        j                         d      t        j                  d4gd5gd67      t        j                  d      t        j                  d4d<d=d>      	       t        j                  d?t        j                  dt        j                         d      t        j                  d@t        j                         d      t        j                  dAt        j                         d      t        j                  dBt        j                         d      t        j                  d4t        j                         d      t        j                  d4gd5gdC7      t        j                  d             t        j                  dDt        j                  dt        j                         d      t        j                  dEt        j                  dd      d      t        j                  dFt        j                         t        j                  d      d      t        j                  dGt        j                         d      t        j                  dGgdHgd67      t        j                  d             t        j                  dDd 8      5 } | j                  dIdGdFgd:       d d d        t        j                  dJt        j                  dt        j                         d      t        j                  dKt        j                  dd      d      t        j                  dLt        j                  dd      d      t        j                  dMt        j                  dd      d      t        j                  dNt        j                         d      t        j                  dGt        j                         d      t        j                  dGgdHgd67      t        j                  dNgdOgdP7      t        j                  d      
       t        j                  dQt        j                  dt        j                         d      t        j                  dRt        j                         d      t        j                  dSt        j
                  d      d      t        j                  d1t        j                  dd      d      t        j                  dTt        j                         d      t        j                  dUt        j                         d      t        j                  dVt        j                         d      t        j                  dt        j                         t        j                  d      d      t        j                  dGt        j                         d      t        j                  d4t        j                         d      t        j                  dWt        j
                  dX      d      t        j                  dYt        j
                  d      d      t        j                  dZt        j                         d      t        j                  d[t        j                          d      t        j                  d\t        j                         d      t        j                  dGgdHgd67      t        j                  d4gd5gd67      t        j                  d\gd]gdC7      t        j                  d             t        j                  dQd 8      5 } | j                  d^dGgd:       | j                  d_d4gd:       | j                  d`dRgd:       d d d        t        j"                  t        j$                  dt        j&                  dt        j
                        t        j&                  dt        j                        t        j&                  dt        j                              dadddbdcdddbdddddbdedddbdfdddbdgdddbdhdddbdidddbdjdddbdkdddbdldddbdmdddbdndddbdodddbg       y # 1 sw Y   	 xY w# 1 sw Y   xY w# 1 sw Y   xY w)pNaccountsidF)nullablename   )lengthtype   institution_nameT	is_activecurrent_balance
      )	precisionscaleapr      min_paymentcredit_limit
created_atz(CURRENT_TIMESTAMP))server_defaultr   
categoriesd   	is_systemuq_categories_name)r	   debtsinterest_ratedue_dateimport_batchesfilename   uploaded_atstatus	row_countcommitted_atpaydown_plansstrategy   extra_monthlyarchived_atlast_recalculated_atsettingsmonthly_incomebillsamountdue_daypayeecategory_idzcategories.idRESTRICT)ondeleteschemaidx_bills_due_date)uniquebudgetsmonthyearuq_budgets_category_month_yearmerchant_mappingsraw_pattern
normalizeduser_confirmedzSET NULLpaydown_balance_updatesbalance
updated_at
account_idzaccounts.ididx_balance_updates_accountpaydown_plan_cardsmonthly_allocationstarting_balancestarting_aprplan_idzpaydown_plans.idCASCADEtransactionsdatemerchant_normalized	is_credit	is_manualnotes
dedup_hash@   issuermerchant_rawconfidence_scoreimport_batch_idzimport_batches.ididx_transactions_accountidx_transactions_categoryidx_transactions_dateHousing)r	   r   r   	GroceriesDiningTransportation	Utilities
HealthcareEntertainmentShoppingSubscriptionszPersonal CarezDebt PaymentsIncome	TransfersUncategorized)r   create_tablesaColumnIntegerStringBooleanNumericDateTimetextPrimaryKeyConstraintUniqueConstraintTextForeignKeyConstraintbatch_alter_tablecreate_indexFloatbulk_inserttablecolumnbatch_ops    _/var/www/html/financials/migrations/versions/e46c47c38302_initial_schema_phase_1_models_and_.pyupgrader      s   OOJIIdBJJL51IIfbiis+e<IIfbiir*U;II "))3"7$GIIk2::<%8IIb!BTRIIeRZZ!15EIImRZZ"A>NIInbjj2Q?$OIIlBKKM"''BW:XchiD! OOLIIdBJJL51IIfbiis+e<IIk2::<%8IIk2::<%8D!%9: OOGIIdBJJL51IIfbiis+e<IIb!BUSIIorzzAQ?%PIImRZZ"A>OIIj"'')d3IIk2::<%8D!	 OO$IIdBJJL51IIj"))3/%@IImR[[]277CX;YdijIIh		,u=IIk2::<$7IInbkkmd;D! OOOIIdBJJL51IIj"))2.?IIorzzBa@5QIIh		,u=IImR[[]T:II$bkkmdCIIlBKKM"''BW:XchiD!	 OOJIIdBJJL51II

Rq ADQD!
 OOGIIdBJJL51IIfbiis+e<IIh

Rq9EJIIi6IIj"'')d3IIgryy,t<IIk2::<%8IImRZZ\D9]Oo->TD! 
		gd	3 Px2ZLOP OOIIIdBJJL51IIgrzz|e4IIfbjjlU3IIh

Rq9EJIImRZZ\E:]Oo->TD!w=]^	 OO'IIdBJJL51IImRWWY7IIlBGGI6II

u=IImRZZ\D9]Oo->TD! OO-IIdBJJL51IIib:UKIIlBKKM"''BW:XchiIIlBJJL59\N]OjQD! 
		7	E i;lL=Ybghi OO(IIdBJJL51II"BJJ1$EPUVII "**r"CeTIInbjj1A>OIIi6IIlBJJL59\N]OjQYK*<)=	RD!
 OONIIdBJJL51IIfbggi%0II#RYYc%:UKIIh

Rq9EJIIk2::<%8IIk2::<%8IIgrwwy40IIlBKKM"''BW:XchiIIlBJJL59IImRZZ\D9IIlBIIR04@IIh		-=IInbggi$7II "((*t<II=\N]OjQ]Oo->T./2E1FQ[\D!'* 
		nT	: Oh8<.QVW9M?SXY5xNO NN
IIfbii(IIk2::.IIk2::.		
 DtL DtLDtL%DtL DtL!DtL$DtLDtL$DtL$DtL$DtLDtL DtL$DtL	
SP P<i iFO Os/   "AG6AHCA AHG6AH HAHHAHc                     t        j                  d       t        j                  dd       5 } | j                  d       | j                  d       | j                  d       d d d        t        j                  d       t        j                  d       t        j                  dd       5 } | j                  d	       d d d        t        j                  d       t        j                  d
       t        j                  d       t        j                  dd       5 } | j                  d       d d d        t        j                  d       t        j                  d       t        j                  d       t        j                  d       t        j                  d       t        j                  d       t        j                  d       y # 1 sw Y   ixY w# 1 sw Y   xY w# 1 sw Y   xY w)Nz*DELETE FROM categories WHERE is_system = 1rP   r9   r^   r]   r\   rJ   rE   rI   rA   r=   r2   r;   r0   r*   r#   r    r   r   )r   executerx   
drop_index
drop_tabler~   s    r   	downgrader      sl   JJ;< 
		nT	: 8h3478678
 MM.!MM&'			7	E ;9:; MM+,MM%&MM)			gd	3 2x012 MM'MM*MM/"MM"#MM'MM,MM*-8 8; ;2 2s#   4G*GG"GG"G+)__doc__alembicr   
sqlalchemyrl   revisiondown_revisionbranch_labels
depends_onr   r        r   <module>r      s4      
ePr   