class CreateCsm extends edu.northwestern.bioinformatics.bering.Migration {
    void up() {
        if (databaseMatches('oracle')) {
            String fileName = "db/migrate/001_release1/CSMOracleSQL.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        } else if (databaseMatches('postgresql')) {
            String fileName = "db/migrate/001_release1/CSMPostgreSQL.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        } else {
            // TODO: need something for HSQLDB.  PostgreSQL script will probably work.
        }
    }
    
    void down() {
        if (databaseMatches('oracle')) {
            String fileName = "db/migrate/001_release1/CSMOracleSQL-drop.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        } else if (databaseMatches('postgresql')) {
            File input = new File("db/migrate/001_release1/CSMPostgreSQL-drop.sql")
            execute(input.text)
        } else {
            // TODO: need something for HSQLDB.  PostgreSQL script will probably work.
        }
    }
}


class CreateCsm extends edu.northwestern.bioinformatics.bering.Migration {
    void up() {
        if (databaseMatches('oracle')) {
            String fileName = "db/migrate/001_release1/CSMOracleSQL.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        } else {
            // note that the PostgreSQL scripts work for HSQLDB, too
            String fileName = "db/migrate/001_release1/CSMPostgreSQL.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        }
    }
    
    void down() {
        if (databaseMatches('oracle')) {
            String fileName = "db/migrate/001_release1/CSMOracleSQL-drop.sql"
            File input = new File(fileName)
            String content = input.text
            execute(content)
        } else {
            // note that the PostgreSQL scripts work for HSQLDB, too
            File input = new File("db/migrate/001_release1/CSMPostgreSQL-drop.sql")
            execute(input.text)
        }
    }
}


Use PostgreSQL scripts in the generic case (including for HSQLDB)
Use PostgreSQL scripts in the generic case (including for HSQLDB)


git-svn-id: 4b387fe5ada7764508e2ca96c335714e4c1692c6@214 0d517254-b314-0410-acde-c619094fa49f
