Skip to content

Instantly share code, notes, and snippets.

blimey74 blimey74

Block or report user

Report or block blimey74

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jeremyjarrell / Idempotent migration in MySQL example
Created Jul 25, 2013
In MySQL, IF statements cannot exist outside of stored procedures. Therefore, to create an idempotent migration for MySQL it's necessary to wrap the migration in a stored procedure and execute that stored procedure against the database to perform the migration.
View Idempotent migration in MySQL example
DROP PROCEDURE IF EXISTS add_email_address_column_to_customers_table $$
-- Create the stored procedure to perform the migration
CREATE PROCEDURE add_email_address_column_to_customers_table()
-- Add the email_address column to the customers table, if it doesn't already exist
You can’t perform that action at this time.