[+] improve alembic
This commit is contained in:
		
							parent
							
								
									d9f5c20557
								
							
						
					
					
						commit
						f8eb591b05
					
				
							
								
								
									
										14
									
								
								deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										14
									
								
								deps/test-task-2025-06-30-v1/python/online/fxreader/pr34/test_task_2025_06_30_v1/tickers/alembic/env.py
									
									
									
									
										vendored
									
									
								
							| @ -18,7 +18,10 @@ if config.config_file_name is not None: | ||||
| # for 'autogenerate' support | ||||
| # from myapp import mymodel | ||||
| # target_metadata = mymodel.Base.metadata | ||||
| target_metadata = None | ||||
| # target_metadata = None | ||||
| from online.fxreader.pr34.test_task_2025_06_30_v1.tickers.settings import Settings | ||||
| from online.fxreader.pr34.test_task_2025_06_30_v1.tickers.models import Base | ||||
| target_metadata = Base.metadata | ||||
| 
 | ||||
| # other values from the config, defined by the needs of env.py, | ||||
| # can be acquired: | ||||
| @ -27,7 +30,6 @@ target_metadata = None | ||||
| 
 | ||||
| 
 | ||||
| def run_migrations_offline() -> None: | ||||
|     from online.fxreader.pr34.test_task_2025_06_30_v1.tickers.settings import Settings | ||||
| 
 | ||||
|     """Run migrations in 'offline' mode. | ||||
| 
 | ||||
| @ -61,10 +63,16 @@ def run_migrations_online() -> None: | ||||
|     and associate a connection with the context. | ||||
| 
 | ||||
|     """ | ||||
| 
 | ||||
|     url = Settings.singleton().db_url | ||||
| 
 | ||||
|     connectable = engine_from_config( | ||||
|         config.get_section(config.config_ini_section, {}), | ||||
|         config.get_section( | ||||
|             config.config_ini_section, {} | ||||
|         ), | ||||
|         prefix="sqlalchemy.", | ||||
|         poolclass=pool.NullPool, | ||||
|         url=url, | ||||
|     ) | ||||
| 
 | ||||
|     with connectable.connect() as connection: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user