{"id":14979077,"url":"https://github.com/uselessscat/fastapi-migrations","last_synced_at":"2025-08-09T07:06:14.929Z","repository":{"id":43292068,"uuid":"289559462","full_name":"uselessscat/fastapi-migrations","owner":"uselessscat","description":"A small integration between Fastapi and Alembic.","archived":false,"fork":false,"pushed_at":"2023-01-19T17:47:21.000Z","size":69,"stargazers_count":25,"open_issues_count":2,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-08-04T04:27:43.043Z","etag":null,"topics":["alembic","fastapi","migration","python","python3","sqlalchemy","vscode"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uselessscat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-22T20:10:05.000Z","updated_at":"2024-08-08T14:01:47.000Z","dependencies_parsed_at":"2023-01-21T11:45:54.188Z","dependency_job_id":null,"html_url":"https://github.com/uselessscat/fastapi-migrations","commit_stats":null,"previous_names":["patiprecios/fastapi-migrations"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/uselessscat/fastapi-migrations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uselessscat%2Ffastapi-migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uselessscat%2Ffastapi-migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uselessscat%2Ffastapi-migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uselessscat%2Ffastapi-migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uselessscat","download_url":"https://codeload.github.com/uselessscat/fastapi-migrations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uselessscat%2Ffastapi-migrations/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269543025,"owners_count":24435213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alembic","fastapi","migration","python","python3","sqlalchemy","vscode"],"created_at":"2024-09-24T13:59:11.573Z","updated_at":"2025-08-09T07:06:14.854Z","avatar_url":"https://github.com/uselessscat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastapi Migrations\n\n![PyPI](https://img.shields.io/pypi/v/fastapi-migrations)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastapi-migrations)\n![PyPI - License](https://img.shields.io/pypi/l/fastapi-migrations)\n\n![GitHub last commit](https://img.shields.io/github/last-commit/uselessscat/fastapi-migrations)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/uselessscat/fastapi-migrations)\n![GitHub issues](https://img.shields.io/github/issues/uselessscat/fastapi-migrations)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/uselessscat/fastapi-migrations)\n\nThis library provides a small wrapper for alembic.\n\n### Notice\n\n**Under inital development. This can not be ready-for-production library.**\n\nThis can means:\n\n- Breaking changes may be introduced\n- Poor documentation and changeslogs\n- Not totally tested\n- Be forced to navigate through the source code to find out how it works\n\nWait to a version \u003e 0.1.0 for usage in production environments.\n\n## Installation\n\nYou can install this library with:\n\n    pip3 install fastapi-migrations\n\n## Usage\n\nYou can use both programatically and by CLI (command line interface).\n\nImagine your project folders\n\n    app/\n        cli/\n            __init__.py\n            action.py\n        db/\n            __init__.py\n            base.py\n        models/\n            __init__.py\n            my_model.py\n        endpoints/\n            __init__.py\n            my_endpoint.py\n        __init__.py\n        config.py\n        main.py\n\nThis is an example of `main.py`:\n\n    from fastapi import FastAPI\n    from fastapi_sqlalchemy import DBSessionMiddleware\n\n    # Load configs and endpoints\n    from app.config import settings\n    from app.endpoints import router\n\n    app: FastAPI = FastAPI(title=settings.project_name)\n\n    # register routes\n    app.include_router(router)\n\n    # add middlewares\n    app.add_middleware(DBSessionMiddleware, db_url=settings.database_uri)\n\n    if __name__ == '__main__':\n        # Load cli commands\n        from app.cli import app as cli\n\n        cli()\n\nThen your `app/cli/__init__.py` can be like:\n\n    import typer\n\n    from fastapi_migrations.cli import MigrationsCli\n    import app.cli.action as action\n\n    # main cli app\n    app: typer.Typer = typer.Typer()\n\n    # these are our cli actions\n    app.add_typer(action.app, name='action', help='Common actions the app do')\n\n    # this line adds the fastapi-migrations cli commands to our app\n    app.add_typer(MigrationsCli())\n\nNow you can call your app from the command line and use `fastapi-migrations` like:\n\n    py app/main.py db show\n\nIf you want to use this library programatically, this is an example:\n\nThe file `app/cli/action.py` can be like:\n\n    import typer\n    from fastapi_migrations import MigrationsConfig, Migrations\n\n    app: typer.Typer = typer.Typer()\n\n    @app.command()\n    def show() -\u003e None:\n        config = MigrationsConfig()\n\n        migrations = Migrations(config)\n\n        migrations.show()\n\nYou can add this lines where you wish in your proyect. Here we ar adding it to a command line so we can call our app like:\n\n    py app/main.py action show\n\n# License\n\nThis software is distributed under [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuselessscat%2Ffastapi-migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuselessscat%2Ffastapi-migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuselessscat%2Ffastapi-migrations/lists"}