Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /opendatalab_labelU /labelu /alembic_labelu /run_migrate.py
| import os | |
| from alembic.command import upgrade | |
| from alembic.config import Config | |
| from alembic.script import ScriptDirectory | |
| from labelu.internal.common.config import settings | |
| def run_db_migrations(): | |
| migrations_dir = os.path.dirname(os.path.realpath(__file__)) | |
| # assumes the alembic.ini is also contained in the current directory of this file | |
| config_file = os.path.join(migrations_dir, "alembic.ini") | |
| config = Config(file_=config_file) | |
| config.set_main_option("script_location", migrations_dir) | |
| config.set_main_option("sqlalchemy.url", settings.DATABASE_URL) | |
| script = ScriptDirectory.from_config(config) | |
| # grab the latest revision | |
| revision = None | |
| for revision in script.walk_revisions(): | |
| revision = revision.revision | |
| break | |
| # run the upgrade function | |
| if revision: | |
| upgrade(config, revision) | |
Xet Storage Details
- Size:
- 867 Bytes
- Xet hash:
- ecc21fad8e5162fd82a05a3c83c3e2fcac94b95eae858f14f9f795aaa4c892ce
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.