Ascetic database migrations. The most ease way to power your python app with raw database migrations
Project description
Ascetic Migrations
For my personal projects I’d like to use raw sql migrations. Django for example generates ugly key names: something like: key_number
Installation
Simply run in your bash:
pip install amigrations
Usage
from amigratons import AMigrations
amigrations = AMigrations('mysql://root:123456@localhost:3306/amigrations_test', path_to_folder_with_migrations)
files_created = amigrations.create(migraiton_message)
# files_created is a dictionary with two keys: up and down. If you want immediately update migration content, please
# do following
with files_created['up'].open('w') as fpu, files_created['down'].open('w') as fpd:
fpu.write('CREATE TABLE test (id int(11) not null AUTO_INCREMENT, PRIMARY KEY(id))')
fpd.write('drop table test')
# run db upgrade
amigrations.upgrade()
# please pass migration id you want to downgrade to, including
amigrations.downgrade_to(downgrade_to_id)
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
amigrations-0.5.tar.gz
(6.4 kB
view details)
File details
Details for the file amigrations-0.5.tar.gz
.
File metadata
- Download URL: amigrations-0.5.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c9506bc74df029cb9d7cd0136dd7b165f256c8fa673a743deeeeecedb81959 |
|
MD5 | d31490fda7d0536812a6c521c5d794db |
|
BLAKE2b-256 | 0aa00900a33c38402e82d0aad1462e9a7ce09ddabe70b6889ac3aea4497509ca |