{"id":17767915,"url":"https://github.com/bezborodow/flask-migratepg","last_synced_at":"2025-06-24T04:32:58.071Z","repository":{"id":176490737,"uuid":"649756381","full_name":"bezborodow/flask-migratepg","owner":"bezborodow","description":"Simple SQL migration command for Flask and Psycopg 3.","archived":false,"fork":false,"pushed_at":"2024-03-04T06:22:45.000Z","size":33,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-25T11:39:22.235Z","etag":null,"topics":["database","flask","migrations","postgresql","psycopg","sql-migration"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flask-migratepg/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bezborodow.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-05T15:05:23.000Z","updated_at":"2024-11-21T03:24:12.000Z","dependencies_parsed_at":"2024-10-26T21:17:10.201Z","dependency_job_id":"1ebf8eea-7149-4b12-8dbe-320d05d980a7","html_url":"https://github.com/bezborodow/flask-migratepg","commit_stats":null,"previous_names":["bezborodow/flask-migratepg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bezborodow/flask-migratepg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-migratepg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-migratepg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-migratepg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-migratepg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezborodow","download_url":"https://codeload.github.com/bezborodow/flask-migratepg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-migratepg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261604258,"owners_count":23183613,"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","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":["database","flask","migrations","postgresql","psycopg","sql-migration"],"created_at":"2024-10-26T20:52:03.434Z","updated_at":"2025-06-24T04:32:58.052Z","avatar_url":"https://github.com/bezborodow.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSQL Database Migrations for Flask with Psycopg\n\n## Synopsis\n\n`flask-migratepg` is a simple migrations tool for Flask and [Psycopg 3](https://www.psycopg.org/psycopg3/).\n\n 1. Install and setup the Flask extension.\n 2. Place SQL migrations under the subdirectory `database/migrations/`.\n 3. Execute migrations with the command **`flask migrate execute`**.\n\n## Installation\n\n```\n$ pip install flask-migratepg\n```\n\nSetup in application:\n\n````python\nfrom flask import Flask\nfrom flask_migratepg import MigratePg\nimport os\n\napp = Flask(__name__)\napp.config.from_mapping(\n    MIGRATIONS_PATH=os.path.abspath('database/migrations'),\n    PSYCOPG_CONNINFO=\"dbname=example host=localhost user=example password=secret\"\n)\nMigratePg(app)\n````\n\n## Usage\n\nCreate a new migration SQL file:\n\n```\n$ flask migrate --help\n$ flask migrate new --help\n$ flask migrate new migration_name\n```\n\nThen to run migrations:\n\n```\n$ flask migrate execute --help\n$ flask migrate execute\n```\n\nThis will run migrations in alphabetical order and track them in a migrations table.\n\nIf there is a failure, the transaction will be rolled back.\n\n### Migration Files\n\nMigrations are placed under `database/migrations/` as an **SQL** file\n(that is, with an `.sql` filename extension.)\n\nThe recommended filename format is `YYMMDD_NNN_migration_name.sql`, for example, `20240219_001_add_table_accounts.sql`.\n\nStatements are separated as per standard SQL conventions with a semicolon.\n\nThese are just plain-text standard SQL files. Comments (lines beginning with `-- `) will be ignored. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezborodow%2Fflask-migratepg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezborodow%2Fflask-migratepg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezborodow%2Fflask-migratepg/lists"}