Last active
October 11, 2015 08:48
-
-
Save tzengerink/3833788 to your computer and use it in GitHub Desktop.
Database Modifications Table
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
/* DATABASE MODIFICATIONS TABLE | |
* ---------------------------- | |
* | |
* Create a database modifications table to keep track of all changes made to | |
* the structure of a database. | |
* | |
* At the bottom of all your scripts that modify the structure, you put a line | |
* like: | |
* | |
* INSERT INTO `database_modifications` (`id`, `script_name`, `comments`) | |
* VALUES ('0001', '0001-initial-database-setup.sql', 'Create initial database setup'); | |
* | |
* Inspired by: http://blog.cherouvim.com/a-table-that-should-exist-in-all-projects-with-a-database/ | |
* | |
* Copyright (c) 2013, T. Zengerink | |
* Licensed under MIT License. | |
* See: https://gist.github.com/raw/3151357/6806e68cb9cc0042b265f25be9bc25dd39f75267/LICENSE.md | |
*/ | |
CREATE TABLE IF NOT EXISTS `database_modifications` ( | |
`id` VARCHAR(255) NOT NULL, | |
`applied_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`script_name` VARCHAR(255) NOT NULL, | |
`comments` VARCHAR(255) DEFAULT '', | |
PRIMARY KEY (`id`) | |
) | |
ENGINE = InnoDB | |
DEFAULT CHARSET = utf8; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment