-
Notifications
You must be signed in to change notification settings - Fork 674
Developer Guide: How to Change the Database Structure
If you need to alter the structure of the ThinkTank database, here’s how.
In the sql/mysql_migrations/
folder, create a new .sql file. The name should include the date, issue number, and a short description of what you’re doing.
For example, on May 3, 2010, if I’m altering the database to work on Issue #200 to add a field called “my_field” to the posts table, I’d create a file called: 2010-05-03_add-myfield-to-posts_issue21.sql
.
In that file, add the SQL alter statements. For example, ALTER TABLE tt_posts ADD myfield VARCHAR( 255 ) NOT NULL;
.
Once you have confirmed that your migration script works, regenerate the sql/build-db_mysql.sql
file using the automated migratedb
shell script. Never edit the build-db_mysql.sql file by hand.
To do so, run the extras/scripts/migratedb
script at the command line. First you’ll need to create and edit your configuration file. Check out the README for instructions on doing that.
Run ThinkTank’s tests to make sure the database creation script works.
There is no step 3.