applyDatabasePatches

applyDatabasePatches()

Attempts to apply all the unapplied database patches. If the patch contains invalid SQL it will revert the transaction and will print the SQL error. Please read carefully the gotcha section for more information.

reservePatches

reservePatches([int])

Creates an [int] amount of empty patches in the patches folder. Useful for teams to avoid merging conflicts in GIT.

  • Developer one plans to do some database changes
  • Developer one reserves 10 patches
  • Developer one commits these empty patches to the database
  • Developer two pulls and notices these new patches
  • Developer two will add his own patches after these ones
  • Developer one will add SQL to these empty patches at his own leisure

Patchr takes care of skipping empty patches and will come back to them once filled with SQL commands.

addNewPatch

addNewPatch([string])

Creates a new patch containing the provided [string] SQL in quotes. Be very careful about escaping the SQL

Unescaped SQL in command line are very dangerous.

It's discouraged to use this command to create complex patches. It is commonly used as a quick alternative to create empty patches. Example:

  • addNewPatch('')
  • Open the newly created patch in your favorite text editor
  • Edit or paste the required SQL in it and save

getUnappliedPatches

getUnappliedPatches()

Returns a list of all currently unapplied patches.

getLatestAppliedPatch

getLatestAppliedPatch()

Returns the name of the latest applied patch.

results matching ""

    No results matching ""