]> source.dussan.org Git - sonarqube.git/commitdiff
Document best practices for DB migration scripts
authorFabrice Bellingard <bellingard@gmail.com>
Tue, 14 Feb 2012 17:17:54 +0000 (18:17 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Tue, 14 Feb 2012 17:18:42 +0000 (18:18 +0100)
sonar-server/src/main/webapp/WEB-INF/db/migrate/README.txt

index e22d74cd5d7f9fd9e7f7ad53fbdccb3262cdd8c7..a5a7e8fcd9148f1d86e4e89d54982d2eca82d798 100644 (file)
@@ -14,3 +14,10 @@ RECOMMANDATIONS
 
 * Don't forget that index name limited to 30 characters in Oracle DB.
 * Prefer to add nullable columns to avoid problems during migration.
+* When adding index, do not forget to name the index (so that it is possible later to delete it)
+  + Example: 
+      add_index "action_plans", "project_id", :name => "ap_project_id"
+* When modifying columns in a table, do not forget to reset the column information on the Ruby model if you use it 
+  + Example:
+      add_column 'users', 'active', :boolean, :null => true, :default => true
+      User.reset_column_information