Skip to content

Commit

Permalink
In migration, added preconditions for table alterations. Also fixed a…
Browse files Browse the repository at this point in the history
… test.

git-svn-id: https://svn.codehaus.org/grails/trunk@8893 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
  • Loading branch information
rhyolight committed Mar 13, 2009
1 parent 102af84 commit c61947d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions migrations/Rhyolight/PluginPortalCommentsMigration.groovy
@@ -1,4 +1,11 @@
changeSet(id:'PluginPortalComments', author:'Rhyolight') {
preConditions {
and {
tableExists(schemaName:'grails', tableName:'blog_entry_comment')
columnExists(schemaName:'grails', tableName:'comment', columnName:'email')
columnExists(schemaName:'grails', tableName:'comment', columnName:'poster')
}
}
dropTable(tableName:'blog_entry_comment')
dropColumn(tableName:'comment', columnName:'email')
dropColumn(tableName:'comment', columnName:'poster')
Expand All @@ -11,20 +18,43 @@ changeSet(id:'IncreaseCommentBodySize', author:'Rhyolight') {
}

changeSet(id:'IntegrateTaggablePlugin', author:'Rhyolight') {
preConditions {
and {
tableExists(schemaName:'grails', tableName:'plugin_tags')
tableExists(schemaName:'grails', tableName:'tag')
}
}
dropTable(tableName:'plugin_tags')
dropTable(tableName:'tag')
}

changeSet(id:'IntegrateCommentablePlugin', author:'Rhyolight') {
preConditions {
and {
tableExists(schemaName:'grails', tableName:'content_comment')
tableExists(schemaName:'grails', tableName:'plugin_comment')
columnExists(schemaName:'grails', tableName:'comment', columnName:'user_id')
}
}
dropTable(tableName:'content_comment')
dropTable(tableName:'plugin_comment')
dropColumn(tableName:'comment', columnName:'user_id')
}

changeSet(id:'UpdateTaggableTagLink', author:'Rhyolight') {
preConditions {
and {
columnExists(schemaName:'grails', tableName:'tag_links', columnName:'tag_class')
}
}
dropColumn(tableName:'tag_links', columnName:'tag_class')
}

changeSet(id:'IntegrateRateablePlugin', author:'Rhyolight') {
preConditions {
and {
tableExists(schemaName:'grails', tableName:'rating')
}
}
dropTable(tableName:'rating')
}
1 change: 1 addition & 0 deletions test/unit/org/grails/plugin/PluginTests.groovy
Expand Up @@ -4,6 +4,7 @@ package org.grails.plugin
*/

import grails.test.GrailsUnitTestCase
import org.grails.rateable.Rating

class PluginTests extends GrailsUnitTestCase {

Expand Down

0 comments on commit c61947d

Please sign in to comment.