o
    g'                     @   s   d dl mZ d dlmZ d dlmZ d dlmZ d dlT d dlm	Z	 ej
Z
e
jdur/ee
j e
dd	 e	jZdddZdddZe rKe  dS e  dS )    )
fileConfig)engine_from_config)pool)context)*)	BaseModelNsqlalchemy.urlzYpostgresql+asyncpg://postgres:Qwerty00$@localhost:5432/tgBotAssistent?async_fallback=truereturnc                  C   sV   t d} tj| tdddid t  t  W d   dS 1 s$w   Y  dS )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
paramstylenamed)urltarget_metadataliteral_bindsdialect_optsN)configget_main_optionr   	configurer   begin_transactionrun_migrations)r    r   CC:\Users\msaig\Desktop\Bots\tgBotAssistent\bot/db/migrations\env.pyrun_migrations_offline   s   


"r   c               	   C   s   t ttji dtjd} |  0}tj|t	d t
  t  W d   n1 s,w   Y  W d   dS W d   dS 1 sDw   Y  dS )zRun migrations in 'online' mode.

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

    zsqlalchemy.)prefix	poolclass)
connectionr   N)r   r   get_sectionconfig_ini_sectionr   NullPoolconnectr   r   r   r   r   )connectabler   r   r   r   run_migrations_online/   s   


"r    )r	   N)Zlogging.configr   
sqlalchemyr   r   alembicr   Zbot.db.modelsZbot.db.baser   r   config_file_nameset_main_optionmetadatar   r   r    is_offline_moder   r   r   r   <module>   s$    





