
    +h                        d dl Z d dlZd dlmZ d dlmZ d dlmZ ej                  Z eej                          ej                  d      Zd Zd Zej                  d e              ej                  d	   j                   Zd
 Zd Zd Zd Z ej,                         r e        y e j.                         j1                   e              y)    N)
fileConfig)current_app)contextzalembic.envc                      	 t         j                  d   j                  j                         S # t        t
        f$ r* t         j                  d   j                  j                  cY S w xY w)Nmigrate)r   
extensionsdb
get_engine	TypeErrorAttributeErrorengine     W/var/www/html/venv/lib/python3.12/site-packages/flask_migrate/templates/aioflask/env.pyr
   r
      sX    ;%%i033>>@@~& ;%%i033:::;s   *- 6A&%A&c                      	 t               j                  j                  d      j                  dd      S # t        $ r0 t        t               j                        j                  dd      cY S w xY w)NF)hide_password%z%%)r
   urlrender_as_stringreplacer   strr   r   r   get_engine_urlr      sd    8|00u0EMM 	 8:<##$,,S$778s   36 6A/.A/sqlalchemy.urlr   c                  h    t        t        d      rt        j                  d    S t        j                  S )N	metadatas)hasattr	target_dbr   metadatar   r   r   get_metadatar   1   s)    y+&""4((r   c                      t         j                  d      } t        j                  | t	               d       t        j
                         5  t        j                          ddd       y# 1 sw Y   yxY w)aF  Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.

    Calls to context.execute() here emit the given string to the
    script output.

    r   T)r   target_metadataliteral_bindsN)configget_main_optionr   	configurer   begin_transactionrun_migrations)r   s    r   run_migrations_offliner(   7   s[     
 
 !1
2Ct 
	"	"	$ ! ! ! !s   
A((A1c                 *   d }t         j                  d   j                  }|j                  d      ||d<   t	        j
                  d| t               d| t	        j                         5  t	        j                          d d d        y # 1 sw Y   y xY w)Nc                     t        t        j                  dd      r;|d   }|j                  j	                         rg |d d  t
        j                  d       y y y )NautogenerateFr   zNo changes in schema detected.)getattrr#   cmd_optsupgrade_opsis_emptyloggerinfo)r   revision
directivesscripts       r   process_revision_directivesz6do_run_migrations.<locals>.process_revision_directivesP   sM    6??NE:]F!!**, "
1<= - ;r   r   r5   )
connectionr!   r   )	r   r   configure_argsgetr   r%   r   r&   r'   )r6   r5   	conf_argss      r   do_run_migrationsr:   L   s    > &&y1@@I}}23;3N	/0 $  
	"	"	$ ! ! ! !s   +B		Bc                     K   t               } | j                         4 d{   }|j                  t               d{    ddd      d{    y7 27 7 	# 1 d{  7  sw Y   yxY ww)zRun migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    N)r
   connectrun_syncr:   )connectabler6   s     r   run_migrations_onliner?   e   se      ,K""$ 5 5
!!"34445 5 545 5 5 5sT   A/AA/AAAA/AA/AA/A, A#!A,(A/)asynciologginglogging.configr   flaskr   alembicr   r#   config_file_name	getLoggerr0   r
   r   set_main_optionr   r	   r   r   r(   r:   r?   is_offline_modeget_event_looprun_until_completer   r   r   <module>rK      s      %   
 6"" #			=	);8   ')9 :""9-00	!*!25 7G//0E0GHr   