
    g]                        S SK Jr  S SKJr  SSKJr  SSKJr  SSK	J
r
  SSK	Jr  \(       a  S S	KJr  \R                  " \R                  5            SS j5       r\R                  " \R"                  5      SS j5       r\R                  " \R&                  5            SS j5       r\R                  " \R*                  5            SS j5       r\R                  " \R.                  5      SS j5       r\R                  " \R2                  5            SS j5       r\R                  " \R6                  5            SS j5       r\R                  " \R:                  5            S S j5       r\R                  " \R>                  5            S!S j5       r \R                  " \RB                  5      S"S j5       r"\R                  " \RF                  5            S#S j5       r$\R                  " \RJ                  5            S$S j5       r&\R                  " \RN                  5            S%S j5       r(\R                  " \RR                  5            S&S j5       r*g
)'    )TYPE_CHECKINGschema   )ops)
Operations   )_copy)sqla_14)TableNc                   ^ U R                   R                  R                  U R                   R                  S 5      mUR                  nUR                  nUR
                  nUR                  nUR                  nUR                  nUR                  nUR                  n	UR                  n
UR                  nUR                  nUR                  nU4S jnU(       as  U(       al  U R                  R!                  U["        R$                  " Xb5      US9nUR&                   H-  nU" U5      (       d  M  U R                   R)                  U5        M/     U R                   R*                  " UU4UU	U
UUUUUUUS.
UR,                  D6  U(       ar  U R                  R!                  UU R                  R/                  Xe5      US9nUR&                   H-  nU" U5      (       d  M  U R                   R1                  U5        M/     g g )Nc                    > [        U [        R                  5      (       + =(       a)    U R                  (       + =(       d    U R                  T5      $ N)
isinstance	sa_schemaPrimaryKeyConstraint_create_rule)
constraintcompilers    a/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/alembic/operations/toimpl.py_count_constraint'alter_column.<locals>._count_constraint&   s<    j)*H*HII 
'''L:+B+B8+L	
    r   )
nullableserver_defaultnametype_r   existing_typeexisting_server_defaultexisting_nullablecommentexisting_comment)impldialectstatement_compilerr   r    r   modify_typecolumn_name
table_namer   modify_server_defaultmodify_namemodify_nullablemodify_commentr"   
schema_objtabler   Columnconstraintsdrop_constraintalter_columnkwcolumnadd_constraint)
operations	operationr   r    r   r   r'   r(   r   r   new_column_namer   r!   r"   r   tr   r   s                    @r   r2   r2      s    &&99H ++M!33'??!!E''K%%JF44N++O((H&&G 11

 !!''[8 ( 

 --J ,,//
; ( OO   %# 7+) ,,  !!''!!((< ( 

 --J ,,..z: ( r   c                     0 nUR                   b%  [        (       d  [        S5      eUR                   US'   U R                  R                  " UR                  U R                  5      40 UD6  g NSQLAlchemy 1.4+ required	if_exists)r=   r   NotImplementedErrorr#   
drop_tableto_tablemigration_contextr6   r7   r3   s      r   r?   r?   P   sa    	B&w%&@AA#--;OO:778<>r   c                     UR                  U R                  5      nU R                  R                  " UR                  U4SUR
                  0UR                  D6  g )Nr   )	to_columnrA   r#   drop_columnr(   r   r3   )r6   r7   r4   s      r   rE   rE   ]   sQ       !=!=>FOOf-6-=-=AJr   c                     UR                  U R                  5      n0 nUR                  b%  [        (       d  [	        S5      eUR                  US'   U R
                  R                  " U40 UD6  g Nr<   if_not_exists)to_indexrA   rH   r   r>   r#   create_index)r6   r7   idxr3   s       r   rJ   rJ   g   sc     

Z99
:C	B*w%&@AA'55?OO  ++r   c                     0 nUR                   b%  [        (       d  [        S5      eUR                   US'   U R                  R                  " UR                  U R                  5      40 UD6  g r;   )r=   r   r>   r#   
drop_indexrI   rA   rB   s      r   rM   rM   u   sa    	B&w%&@AA#--;OO:778
r   c                     0 nUR                   b%  [        (       d  [        S5      eUR                   US'   UR                  U R                  5      nU R
                  R                  " U40 UD6  U$ rG   )rH   r   r>   r@   rA   r#   create_table)r6   r7   r3   r.   s       r   rO   rO      sh     
B*w%&@AA'55?z;;<EOO  -"-Lr   c                 v    U R                   R                  UR                  UR                  UR                  S9  g Nr   )r#   rename_tabler(   new_table_namer   r6   r7   s     r   rR   rR      s4     OO  i66y?O?O ! r   c                 p    UR                  U R                  5      nU R                  R                  U5        g r   )r@   rA   r#   create_table_commentr6   r7   r.   s      r   rV   rV      s,     z;;<EOO((/r   c                 p    UR                  U R                  5      nU R                  R                  U5        g r   )r@   rA   r#   drop_table_commentrW   s      r   rY   rY      s,     z;;<EOO&&u-r   c                    UR                   nUR                  nUR                  nUR                  nUR                  b  [        U5      nU R                  R	                  X#US9nU R                  R                  " X#4SU0UD6  UR                   H?  n[        U[        R                  5      (       a  M$  U R                  R                  U5        MA     UR                   H  nU R                  R                  U5        M      U R                  R                   R"                  =(       a%    U R                  R                   R$                  (       + n	UR&                  n
U
(       a$  U	(       a  U R                  R)                  U5        g g g )Nr   r   )r(   r4   r   r3   r.   r
   r-   r#   
add_columnr0   r   r   r   r5   indexesrJ   r$   supports_commentsinline_commentsr!   create_column_comment)r6   r7   r(   r4   r   r3   r9   r   indexwith_commentr!   s              r   r[   r[      s)   %%JFF	B||v##Jv#FAOOzG&GBGmm
*i&D&DEEOO**:6 $ $$U+  	11 	8''777  nnG<--f5  wr   c                 l    U R                   R                  UR                  U R                  5      5        g r   )r#   r5   to_constraintrA   rT   s     r   create_constraintrd      s*     OO""
 < <=r   c           	          U R                   R                  U R                  R                  UR                  UR
                  UR                  UR                  S95        g rQ   )r#   r1   r-   generic_constraintconstraint_namer(   constraint_typer   rT   s     r   r1   r1      sS     OO##00%%  %%##	 	1 	
r   c                 v    U R                   R                  UR                  UR                  UR                  S9  g )N)multiinsert)r#   bulk_insertr.   rowsrj   rT   s     r   rk   rk      s0     OOY5J5J   r   c                 t    U R                   R                  R                  UR                  UR                  S9  g )N)execution_options)rA   r#   executesqltextrn   rT   s     r   execute_sqlrq      s4       %%--Y-H-H . r   )r6   r   r7   zops.AlterColumnOpreturnN)r6   r   r7   zops.DropTableOprr   N)r6   r   r7   zops.DropColumnOprr   N)r6   r   r7   zops.CreateIndexOprr   N)r6   r   r7   zops.DropIndexOprr   N)r6   r   r7   zops.CreateTableOprr   r   )r6   r   r7   zops.RenameTableOprr   N)r6   r   r7   zops.CreateTableCommentOprr   N)r6   r   r7   zops.DropTableCommentOprr   N)r6   r   r7   zops.AddColumnOprr   N)r6   r   r7   zops.AddConstraintOprr   N)r6   r   r7   zops.DropConstraintOprr   N)r6   r   r7   zops.BulkInsertOprr   N)r6   r   r7   zops.ExecuteSQLOprr   N)+typingr   
sqlalchemyr   r    r   baser   util.sqla_compatr
   r   sqlalchemy.sql.schemar   implementation_forAlterColumnOpr2   DropTableOpr?   DropColumnOprE   CreateIndexOprJ   DropIndexOprM   CreateTableOprO   RenameTableOprR   CreateTableCommentOprV   DropTableCommentOprY   AddColumnOpr[   AddConstraintOprd   DropConstraintOpr1   BulkInsertOprk   ExecuteSQLOprq    r   r   <module>r      s(   ! *   $ &+ s001;;;;)<;;	;; 2;;| s/	 0	 s//0);	 1 s001
,
,)<
,	
, 2
, s/ 0 s001)< 2 s001)<	 2 s77800)C0	0 90 s556..)A.	. 7. s/6 066 s223)>	 4 s334

)?
	
 5
 s//0);	 1 s//0);	 1r   