Simple tool for managing raw sql migrations scripts.
Project description
Status
Latest stable
Develop
Goal
Raw-sql-migrate is tool for managing your raw SQL migrations.
Docs
See <http://rsm.readthedocs.org/en/latest/> page for full docs.
Short guide
Create rsm.yaml or rsm.py in your project dir with next structure:
database:
engine: engine backend module
host: database host
port: database port
name: database name
user: user name
password: user password
history_table_name: migration history table name
RSM_CONFIG = {
'database': {
'engine': engine backend module,
'host': database host,
'port': database port,
'name': database name,
'user': user name,
'password': user password,
},
'history_table_name': migration history table name,
'packages': [
'package_a',
'package_b',
'package_c.package_d',
],
}
Create first migration
rsm create package_a.package_b initial
Edit migration file found package_a/package_b/migrations/0001_initial.py. Example:
def forward(database_api):
database_api.execute(
'''
CREATE TABLE test (
id INT PRIMARY KEY NOT NULL,
test_value BIGINT NOT NULL,
);
CREATE INDEX test_value_index ON test(test_value);
'''
)
def backward(database_api):
database_api.execute('DROP TABLE test;')
Run migrations:
rsm migrate package_a.package_b
Migrating backwards:
rsm migrate package_a.package_b 0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
raw-sql-migrate-0.3.4.tar.gz
(11.4 kB
view details)
File details
Details for the file raw-sql-migrate-0.3.4.tar.gz
.
File metadata
- Download URL: raw-sql-migrate-0.3.4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e41e38f81fccae36640a1f64837c107ff8289dc76b7aab624a250dc6a136151 |
|
MD5 | 111689ad8d37042b4003037c2350e03d |
|
BLAKE2b-256 | 171b7655426de3169d5b383399c30216260ebdf76e6c16ec17bfc1f1f78e5336 |