Define the schema in code, fixed up some bugs.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3871 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-02-20 22:41:59 +00:00
parent 9d9bebd092
commit a4fff6494f
4 changed files with 9 additions and 32 deletions
@@ -56,7 +56,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
// documentation inherited
protected ObjectRecord createObjectRecord (String path, DObject object)
{
return null;
return new DatabaseObjectRecord(path, object);
}
protected class DatabaseObjectRecord extends ObjectRecord
@@ -90,17 +90,20 @@ public class ConfigRepository extends JORARepository
protected void migrateSchema (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
if (!JDBCUtil.tableExists(conn, "CONFIG")) {
Log.info("Creating admin.config schema...");
JDBCUtil.loadSchema(conn, "admin/config.sql");
}
JDBCUtil.createTableIfMissing(conn, "CONFIG", new String[] {
"OBJECT VARCHAR(255) NOT NULL",
"FIELD VARCHAR(255) NOT NULL",
"VALUE TEXT NOT NULL",
"PRIMARY KEY (OBJECT, FIELD)",
});
}
// documentation inherited
protected void createTables (Session session)
{
_ctable = new Table(
ConfigDatum.class.getName(), "CONFIG", session, "OBJECT", true);
ConfigDatum.class.getName(), "CONFIG", session,
new String[] { "OBJECT", "FIELD" }, true);
}
protected Table _ctable;
-25
View File
@@ -1,25 +0,0 @@
/**
* $Id$
*
* Schema for the Admin services configuration table.
*/
drop table if exists CONFIG;
/**
* Contains all registered configuration data.
*/
CREATE TABLE CONFIG
(
/** The configuration object with which this datum is associated. */
OBJECT VARCHAR(255) NOT NULL,
/** The configuration object field name. */
FIELD VARCHAR(255) NOT NULL,
/** The value of the object field. */
VALUE TEXT NOT NULL,
/** Defines our table keys. */
PRIMARY KEY (OBJECT, FIELD)
);