blob: 9417726e5416775cfacccc6af6460e2032c13b1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/bash
if [ $# -ne 1 ]; then
echo 'usage: bin/newmigration <name>'
exit 1
fi
cd "$(dirname "$0")" || exit 2
cd ../migrations || exit 2
version="$(date +'%Y%m%d_%H%M%S')"
migratorFullClassName="$(find .. -name Migrator.php | sed 's_/_\\_g;s/^\.*//;s/\.php$//')"
cat > "${version}_$1.php" << EOT
<?php
use $migratorFullClassName;
Migrator::getInstance()->register($version, function (PDO \$db) {
// your code here
});
EOT
|