div tzg
This commit is contained in:
27
create_migration
Executable file
27
create_migration
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No Arguments supplied"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "creating a new migration"
|
||||
./migration.py compare_model_to_db storage.metadata
|
||||
|
||||
echo "Dump current database state to file"
|
||||
./migration.py create_model > oldmodel.py
|
||||
|
||||
ls db_repository/versions
|
||||
echo "Choose a filename for the new migration"
|
||||
read filename
|
||||
|
||||
./migration.py make_update_script_for_model --oldmodel=oldmodel:meta --model=storage:metadata > db_repository/versions/$filename.py
|
||||
|
||||
cp test.sqlite test.sqlite.bak
|
||||
./migration.py test
|
||||
rm test.sqlite
|
||||
mv test.sqlite.bak test.sqlite
|
||||
|
||||
|
||||
|
||||
rm oldmodel.py
|
||||
Reference in New Issue
Block a user