A dead simple ProstgreSQL migrations manager
Reason this release was yanked:
Was test
Project description
Petite
A dead simple PostgreSQL migrations manager. Perfect for small to medium size projects that just need a small and simple tool.
Installation
There are two main options when installing petite. You could install it as a system wide tool or you could install on a per project basis. If installing as a system wide tool I recommend using pipx. If installing on a per project basis I recommend installing within a virtual environment.
pipx
pipx install petite-cli
pip
pip install petite-cli
Usage
Petite has only 3 commands setup, new, and apply. You are intended to run setup first. Then new to create new migration files. Then apply to run those migration files against the database. Below is a quick outline of each command but more detailed information can be found in the help menu once installed:
setup
This command is intended to be the first command ran when setting up a new project. This will create a migration table in your PostgreSQL database and create a directory to hold your migration files.
Example
petite setup --postgres-uri postgresql://... --migrations-directory /.../migrations
new
This command should be ran after setup. It creates a new file in the migrations directory where you can put your SQL code. It's ill advised that you create your own files as the file name is used as a means of ordering the migrations.
Example
petite new migration_name --postgres-uri postgresql://... --migrations-directory /.../migrations
apply
This command should be run after setup and once new migrations have been created with new. It will find new migrations then apply the specified number to the database in order of oldest unapplied to newest. If any fail all the migrations applied during the execution of the command will be rolled back.
Example
petite apply 2 --postgres-uri postgresql://... --migrations-directory /.../migrations
Contributing
Contributions are always welcome! Just make a pull request before you start working on anything so I can let you know if its something I want to add.
Running Tests
To run unit tests, run the following command:
poetry run pytest
To run integration tests first ensure you have docker installed as its used to bring up a PostgreSQL instance. You might also need to add your current user to the docker group see here for more information. Once this is complete run the following command:
poetry run pytest tests/integration
Build Locally
This project uses poetry so I would recommend you use it as well. It would make building the project much easier and all the examples below will be making use of it.
Clone the project
git clone https://github.com/ky-42/petite
Go to the project directory
cd petite
Install dependencies
poetry install
Build the sdist and wheel files
poetry build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file petite_cli-0.0.1.tar.gz.
File metadata
- Download URL: petite_cli-0.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.9.3-76060903-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765c1e0c4240fd1c407a08e04843f57a856f2482d587df3d56c49a772022a31e
|
|
| MD5 |
540cb5b7692fdfba5b4971add8de726f
|
|
| BLAKE2b-256 |
da9d981a8f0322185046ee1b4475a79d07fef561f5240a3dd0c521dd7d30fc4f
|
File details
Details for the file petite_cli-0.0.1-py3-none-any.whl.
File metadata
- Download URL: petite_cli-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.9.3-76060903-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e9260180d0066fc469696f271c17b47b6b9a4985e2c532c3147e902c5bf430
|
|
| MD5 |
69904176f3ea3605da930beef118fa42
|
|
| BLAKE2b-256 |
31d0fd6f8d8b89ed3e1e369358fe81857762928cbaff817f3291b481df09ab9e
|