Created
October 9, 2019 18:57
-
-
Save chrisguitarguy/2682cb2ce2cf2275b7f43ad729d3c78e to your computer and use it in GitHub Desktop.
Upgrade doctrine/migrations from 1.X to 2.X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ "$#" != 1 ]; then | |
echo "Usage: $0 {migrationsDirectory}" >&2 | |
exit 1 | |
fi | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/Doctrine\\DBAL\\Migrations\\AbstractMigration/Doctrine\\Migrations\\AbstractMigration/' {} \; | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/function up(Schema \$schema)$/function up(Schema $schema) : void/' {} \; | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/function down(Schema \$schema)$/function down(Schema $schema) : void/' {} \; | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/function preUp(Schema \$schema)$/function preUp(Schema $schema) : void/' {} \; | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/function preDown(Schema \$schema)$/function preDown(Schema $schema) : void/' {} \; | |
find "$1" -type f -name '*.php' -exec sed -i '' 's/function getDescription()$/function getDescription() : string/' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment