Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Created February 1, 2020 19:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Upgrade doctrine migrations to 2.0
#!/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