https://github.com/bp72/simple-migrations
A python library for maintaining pure sql migrations in postgresql databases.
https://github.com/bp72/simple-migrations
migrations postgresql psycopg python sql
Last synced: 3 months ago
JSON representation
A python library for maintaining pure sql migrations in postgresql databases.
- Host: GitHub
- URL: https://github.com/bp72/simple-migrations
- Owner: bp72
- License: mit
- Created: 2023-12-25T10:26:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-04T15:29:01.000Z (about 2 years ago)
- Last Synced: 2025-12-07T01:43:04.288Z (4 months ago)
- Topics: migrations, postgresql, psycopg, python, sql
- Language: Python
- Homepage: https://pypi.org/project/simple-migrations/
- Size: 21.5 KB
- Stars: 26
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-migrations (beta)
[](https://pypi.org/project/simple-migrations)
[](https://pypi.org/project/simple-migrations)
### The feedback and contributions are appreciated!
Make your database migrations as simple as possible!
`simple-migrations` is a library that allows you to write database migrations in a pure SQL.
The order of migrations will be tracked in the database table.
You can specify the `forwards` and `backwards` command and even write your own scripts.
No need to apply the scripts manually, you can now automate your deployment flow!
Keep in mind that the library is still in development and is distributed "as is".
## How to use
The example of the config can be found in `simple_migrations.ini` file.
Create a `simple_migrations.ini` file in the project root and set up the database credentials.
Run `simple-migrations init` to generate the migrations directory and migrations table.
Run `simple-migrations generate` to generate the migration file from the template.
Run `simple-migrations migrate` to apply all unapplied migrations.
Run `simple-migrations migrate ` to migrate or rollback to migration, for example:
- If the last applied migration was #2, `simple-migrations migrate 4` will apply migrations 3 and 4.
- If the last applied migration was #4, `simple-migrations migrate 2` will rollback migrations 3 and 4.