No project description provided
Project description
##########################################
__ __ _ _ ___ _
| \/ (_) __ _ _ __ __ _| |_ ___|_ _| |_
| |\/| | |/ _` | '__/ _` | __/ _ \| || __|
| | | | | (_| | | | (_| | || __/| || |_
|_| |_|_|\__, |_| \__,_|\__\___|___|\__|
|___/
##########################################
Handle database migrations with ease managing your database changes with simple SQL files. Make the migration process easier, more manageable and repeteable.
How does this work
Installation
pip install migrateit
Configuration
Configurations can be changed as environment variables.
# basic configuration
MIGRATEIT_DATABASE=postgresql
MIGRATEIT_MIGRATIONS_TABLE=MIGRATEIT_CHANGELOG
MIGRATEIT_MIGRATIONS_DIR=migrateit
# change the database connection variables
VARNAME_DB_URL=DB_URL
VARNAME_DB_HOST=DB_HOST
VARNAME_DB_PORT=DB_PORT
VARNAME_DB_USER=DB_USER
VARNAME_DB_PASS=DB_PASS
VARNAME_DB_NAME=DB_NAME
# database configuration
DB_URL=postgresql://postgres:postgres@localhost:5432/postgres
# -------- or ----------
DB_HOST=localhost
DB_PORT=5432
DB_NAME=postgres
DB_USER=postgres
DB_PASS=postgres
Usage
# initialize MigrateIt to create:
# - database table in the configured database
# - 'migrations' directory inside the MIGRATIONS_DIR
# - 'changelog.json' file inside the MIGRATIONS_DIR
migrateit init
# create a new migration file
migrateit newmigration first_migration
# add your sql commands to the migration file
echo "CREATE TABLE test (id SERIAL PRIMARY KEY, name VARCHAR(50));" > migrateit/0001_first_migration.sql
# show pending migrations
migrateit showmigrations
# run the migrations
migrateit migrate
# run a given migration
migrateit migrate 0001
HELP
usage: migrateit migrate [-h] [--fake] [--update-hash] [--rollback] [name]
positional arguments:
name Name of the migration to run
options:
-h, --help show this help message and exit
--fake Fakes the migration marking it as ran.
--update-hash Update the hash of the migration.
--rollback Undo the given migration and all its applied childs.
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
migrateit-0.3.0.tar.gz
(13.2 kB
view details)
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
migrateit-0.3.0-py3-none-any.whl
(16.5 kB
view details)
File details
Details for the file migrateit-0.3.0.tar.gz.
File metadata
- Download URL: migrateit-0.3.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5b8d460fa951caebe2ec5b2d0f6b5ed461e0cbd5ea51659a58a39a60a0cf6d5
|
|
| MD5 |
ab73047ad82fba7ff1776a8fc8256c25
|
|
| BLAKE2b-256 |
f7f4e8f4b052740ea18a07ca4452656ccce63a2e0b15620a7ae8a9b60f85f717
|
File details
Details for the file migrateit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: migrateit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bfb0788d561407415bf4c6ebfa7e47ad2245be533ffc3e3c5654a1087532a3b
|
|
| MD5 |
7ce3394160c732acfeb7a6a28dd4b4a6
|
|
| BLAKE2b-256 |
ec5ac68eb2dd1821a99eda0b8ec21932200153e14114a24f955a7b25dc60c914
|