package journal.schema; import java.util.ArrayList; import java.util.List; import java.util.HashMap; import java.util.Map; public class Schema { private static Map<String, Table> tables = new HashMap<String, Table>(); private static List<String> tableNamesInOrder = new ArrayList<String>(); public static TableVersion GetTableVersion(String name, int version) { Table table = tables.get(name); if (table == null) { return null; } TableVersion tableVersion = table.getVersion(version); return tableVersion; } public static int GetTableIndex(String name) { return tableNamesInOrder.indexOf(name); } static { // list every table // every version // every attribute // then think of a better way Table table; TableVersion version; // Counters // db.counters table = new Table("db.counters"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("value", Domain.INT); version = new TableVersion(version, 1); version.removeAttribute("value"); version.addAttribute("value", Domain.TEXT); addTable(table); table.addIndex("name", true); Table counters = table; // db.nameval table = new Table("db.nameval"); version = new TableVersion(table, 0); version.addAttributes(counters.getVersion(0)); version = new TableVersion(table, 1); version.addAttributes(counters.getVersion(1)); addTable(table); table.addIndex("name", true); // db.logger table = new Table("db.logger"); version = new TableVersion(table, 0); version.addAttribute("seq", Domain.INT); version.addAttribute("key", Domain.KEY); version.addAttribute("attr", Domain.KEY); addTable(table); table.addIndex("seq", true); // db.ldap table = new Table("db.ldap"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("host", Domain.TEXT); version.addAttribute("port", Domain.INT); version.addAttribute("ssl", Domain.INT); version.addAttribute("type", Domain.INT); version.addAttribute("pattern", Domain.TEXT); version.addAttribute("basedn", Domain.TEXT); version.addAttribute("filter", Domain.TEXT); version.addAttribute("scope", Domain.INT); version.addAttribute("binddn", Domain.TEXT); version.addAttribute("bindpass", Domain.TEXT); version.addAttribute("realm", Domain.TEXT); version.addAttribute("grpbasedn", Domain.TEXT); version.addAttribute("grpfilter", Domain.TEXT); version.addAttribute("grpscope", Domain.TEXT); version.addAttribute("options", Domain.TEXT); version.addAttribute("attruid", Domain.TEXT); version.addAttribute("attremail", Domain.TEXT); version.addAttribute("attrname", Domain.TEXT); addTable(table); table.addIndex("name", true); // db.config table = new Table("db.config"); version = new TableVersion(table, 0); // dummy version.addAttribute("sname", Domain.KEY); version.addAttribute("name", Domain.KEY); version.addAttribute("value", Domain.TEXT); version = new TableVersion(version, 1); addTable(table); table.addIndex("sname", true); table.addIndex("name", true); // db.server table = new Table("db.server"); version = new TableVersion(table, 0); version.addAttribute("id", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("name", Domain.TEXT); version.addAttribute("address", Domain.TEXT); version.addAttribute("services", Domain.INT64); version.addAttribute("desc", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("user", Domain.TEXT); version = new TableVersion(version, 2); version.addAttribute("externalAddress", Domain.TEXT,4); version.addAttribute("user", Domain.TEXT); addTable(table); table.addIndex("id", true); // db.svrview table = new Table("db.svrview"); version = new TableVersion(table, 0); version.addAttribute("id", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("seq", Domain.INT); version.addAttribute("mapflag", Domain.INT); version.addAttribute("vfile", Domain.KEY); addTable(table); table.addIndex("id", true); table.addIndex("type", true); table.addIndex("seq", true); // db.remote table = new Table("db.remote"); version = new TableVersion(table, 0); version.addAttribute("id", Domain.KEY); version.addAttribute("owner", Domain.TEXT); version.addAttribute("options", Domain.INT); version.addAttribute("address", Domain.TEXT); version.addAttribute("desc", Domain.TEXT); version.addAttribute("update", Domain.DATE); version.addAttribute("access", Domain.DATE); version.addAttribute("fetch", Domain.INT); version.addAttribute("push", Domain.INT); version = new TableVersion(version, 1); version.addAttribute("rmtuser", Domain.KEY); addTable(table); table.addIndex("id", true); // db.rmtview table = new Table("db.rmtview"); version = new TableVersion(table, 0); version.addAttribute("id", Domain.KEY); version.addAttribute("seq", Domain.INT); version.addAttribute("mapflag", Domain.INT); version.addAttribute("lfile", Domain.KEY); version.addAttribute("rfile", Domain.KEY); version = new TableVersion(version, 1); version.addAttribute("retain", Domain.INT); addTable(table); table.addIndex("id", true); // db.ticket table = new Table("db.ticket"); version = new TableVersion(table, 0); version.addAttribute("user", Domain.KEY); version.addAttribute("host", Domain.KEY); version.addAttribute("ticket", Domain.TEXT); version.addAttribute("state", Domain.INT); version.addAttribute("token", Domain.TEXT); version.addAttribute("update", Domain.DATE); addTable(table); table.addIndex("user", true); table.addIndex("host", true); TableVersion ticket = version; // db.ticket.rp table = new Table("db.ticket.rp"); version = new TableVersion(table, 0); version.addAttributes(ticket); addTable(table); table.addIndex("user", true); table.addIndex("host", true); // db.stash table = new Table("db.stash"); version = new TableVersion(table, 0); version.addAttribute("client", Domain.KEY); version.addAttribute("stream", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("seq", Domain.INT); version.addAttribute("change", Domain.INT); addTable(table); table.addIndex("client", true); table.addIndex("stream", true); table.addIndex("type", true); table.addIndex("seq", true); // Client data // db.user table = new Table("db.user"); version = new TableVersion(table, 0); version.addAttribute("user", Domain.KEY); version.addAttribute("email", Domain.TEXT); version.addAttribute("ojobview", Domain.INT); version.addAttribute("update", Domain.DATE); version.addAttribute("access", Domain.DATE); version.addAttribute("fullname", Domain.TEXT); version = new TableVersion(version, 1); version = new TableVersion(version, 2); version.removeAttribute("ojobview"); version.addAttribute("jobview", Domain.TEXT, 2); version.addAttribute("password", Domain.TEXT); version = new TableVersion(version, 3); version.addAttribute("strength", Domain.INT); version.addAttribute("ticket", Domain.TEXT); version.addAttribute("enddate", Domain.DATE); version = new TableVersion(version, 4); version.addAttribute("type", Domain.INT); version.addAttribute("passdate", Domain.DATE); version = new TableVersion(version, 5); version.addAttribute("passexpire", Domain.DATE); version = new TableVersion(version, 6); version.addAttribute("attempts", Domain.DATE); version = new TableVersion(version, 7); version.addAttribute("auth", Domain.INT); addTable(table); table.addIndex("user", true); // db.group table = new Table("db.group"); version = new TableVersion(table, 0); version.addAttribute("user", Domain.KEY); version.addAttribute("group", Domain.KEY); version = new TableVersion(version, 1); version.addAttribute("maxr", Domain.INT); version = new TableVersion(version, 2); version.addAttribute("type", Domain.INT, 2); version = new TableVersion(version, 3); version.addAttribute("maxs", Domain.INT); version = new TableVersion(version, 4); version.addAttribute("timeout", Domain.INT); version = new TableVersion(version, 5); version.addAttribute("maxl", Domain.INT, 5); version = new TableVersion(version, 6); version = new TableVersion(version, 7); version = new TableVersion(version, 8); version.addAttribute("passtimeout", Domain.INT); version = new TableVersion(version, 9); version.addAttribute("maxf", Domain.INT, 6); addTable(table); table.addIndex("user", true); table.addIndex("group", true); // db.groupx table = new Table("db.groupx"); version = new TableVersion(table, 0); version.addAttribute("group", Domain.KEY); version.addAttribute("lconf", Domain.TEXT); version.addAttribute("lgrpquery", Domain.TEXT); version.addAttribute("luidattr", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("ludnattr", Domain.TEXT); addTable(table); table.addIndex("group", true); // db.depot table = new Table("db.depot"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("extra", Domain.TEXT); version.addAttribute("map", Domain.TEXT); version = new TableVersion(version, 1); addTable(table); table.addIndex("name", true); // db.property table = new Table("db.property"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("sequence", Domain.TEXT); version.addAttribute("type", Domain.INT); version.addAttribute("scope", Domain.TEXT); version.addAttribute("value", Domain.TEXT); version.addAttribute("date", Domain.DATE); version.addAttribute("user", Domain.TEXT); addTable(table); table.addIndex("name", true); table.addIndex("sequence", true); table.addIndex("type", true); table.addIndex("scope", true); // db.stream table = new Table("db.stream"); version = new TableVersion(table, 0); version.addAttribute("stream", Domain.KEY); version.addAttribute("parent", Domain.KEY); version = new TableVersion(version, 1); version.addAttribute("title", Domain.TEXT); version.addAttribute("type", Domain.INT); version.addAttribute("preview", Domain.INT); version.addAttribute("change", Domain.INT); version.addAttribute("copychg", Domain.INT); version.addAttribute("mergechg", Domain.INT); version.addAttribute("highchg", Domain.INT); version.addAttribute("hash", Domain.INT); version.addAttribute("status", Domain.INT); addTable(table); table.addIndex("stream", true); table.addIndex("parent", true); // db.domain table = new Table("db.domain"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("extra", Domain.TEXT); version.addAttribute("mount", Domain.TEXT); version.addAttribute("owner", Domain.KEY); version.addAttribute("update", Domain.DATE); version.addAttribute("options", Domain.INT); version.addAttribute("desc", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("access", Domain.DATE, 6); version = new TableVersion(version, 2); version.addAttribute("mapstate", Domain.INT, 8); version = new TableVersion(version, 3); version.addAttribute("mount2", Domain.TEXT, 4); version.addAttribute("mount3", Domain.TEXT, 5); version = new TableVersion(version, 4); version.removeAttribute("mapstate"); version = new TableVersion(version, 5); version.addAttribute("stream", Domain.TEXT); version = new TableVersion(version, 6); version.addAttribute("serverid", Domain.TEXT); version.addAttribute("partition", Domain.INT); version = new TableVersion(version, 7); version.removeAttribute("partition"); version.addAttribute("contents", Domain.TEXT); addTable(table); table.addIndex("name", true); // db.template table = new Table("db.template"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("change", Domain.KEY); version.addAttribute("seq", Domain.KEY); version.addAttribute("parent", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("path", Domain.INT); version.addAttribute("vfile", Domain.TEXT); version.addAttribute("dfile", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("ccmap", Domain.INT); version = new TableVersion(version, 2); version.removeAttribute("ccmap"); version.addAttribute("cmap", Domain.TEXT); addTable(table); table.addIndex("name", true); table.addIndex("change", false); table.addIndex("seq", true); table.addIndex("parent", true); // db.templatesx table = new Table("db.templatesx"); version = new TableVersion(table, 0); version.addAttribute("shelf", Domain.INT); version.addAttribute("name", Domain.KEY); version.addAttribute("seq", Domain.KEY); version.addAttribute("change", Domain.INT); version.addAttribute("parent", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("path", Domain.INT); version.addAttribute("vfile", Domain.TEXT); version.addAttribute("dfile", Domain.TEXT); version.addAttribute("cmap", Domain.TEXT); addTable(table); table.addIndex("shelf", true); table.addIndex("name", true); table.addIndex("seq", true); // db.templatewx table = new Table("db.templatewx"); version = new TableVersion(table, 0); version.addAttribute("client", Domain.KEY); version.addAttribute("name", Domain.KEY); version.addAttribute("seq", Domain.KEY); version.addAttribute("change", Domain.INT); version.addAttribute("parent", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("path", Domain.INT); version.addAttribute("vfile", Domain.TEXT); version.addAttribute("dfile", Domain.TEXT); version.addAttribute("cmap", Domain.TEXT); addTable(table); table.addIndex("client", true); table.addIndex("change", false); table.addIndex("seq", true); // db.view table = new Table("db.view"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("seq", Domain.INT); version.addAttribute("mapflag", Domain.INT); version.addAttribute("vfile", Domain.KEY); version.addAttribute("dfile", Domain.KEY); version = new TableVersion(version, 1); addTable(table); table.addIndex("name", true); table.addIndex("seq", true); Table view = table; // db.view.rp table = new Table("db.view.rp"); version = new TableVersion(table, 0); version.addAttributes(view.getVersion(0)); version = new TableVersion(version, 1); version.addAttributes(view.getVersion(1)); addTable(table); table.addIndex("name", true); table.addIndex("seq", true); // db.review table = new Table("db.review"); version = new TableVersion(table, 0); version.addAttribute("user", Domain.KEY); // schema says 'name', but I am going to cheat here version.addAttribute("seq", Domain.INT); version.addAttribute("mapflag", Domain.INT); version.addAttribute("dfile", Domain.KEY); version.addAttribute("type", Domain.INT); version = new TableVersion(version, 1); addTable(table); table.addIndex("user", true); table.addIndex("seq", true); // Files data // db.integ table = new Table("db.integ"); version = new TableVersion(table, 0); version.addAttribute("tfile", Domain.KEY); version.addAttribute("ffile", Domain.KEY); version.addAttribute("sfrev", Domain.INT); version.addAttribute("efrev", Domain.INT); version.addAttribute("tfrev", Domain.INT); version.addAttribute("how", Domain.INT); version.addAttribute("comm", Domain.INT); version.addAttribute("res", Domain.INT); version.addAttribute("change", Domain.INT); addTable(table); table.addIndex("tfile", true); table.addIndex("ffile", true); table.addIndex("sfrev", true); // db.integed table = new Table("db.integed"); version = new TableVersion(table, 0); version.addAttribute("tfile", Domain.KEY); version.addAttribute("ffile", Domain.KEY); version.addAttribute("sfrev", Domain.INT); version.addAttribute("efrev", Domain.INT); version.addAttribute("strev", Domain.INT); version.addAttribute("etrev", Domain.INT); version.addAttribute("how", Domain.INT); version.addAttribute("change", Domain.INT); addTable(table); table.addIndex("tfile", true); table.addIndex("ffile", true); table.addIndex("sfrev", true); table.addIndex("efrev", true); table.addIndex("strev", true); table.addIndex("etrev", true); Table integed = table; // db.integtx table = new Table("db.integtx"); version = new TableVersion(table, 0); version.addAttributes(integed.getVersion(0)); addTable(table); table.addIndex("tfile", true); table.addIndex("ffile", true); table.addIndex("sfrev", true); table.addIndex("efrev", true); table.addIndex("strev", true); table.addIndex("etrev", true); // db.resolve table = new Table("db.resolve"); version = new TableVersion(table, 0); version.addAttribute("tfile", Domain.KEY); version.addAttribute("ffile", Domain.KEY); version.addAttribute("sfrev", Domain.INT); version.addAttribute("efrev", Domain.INT); version.addAttribute("strev", Domain.INT); version.addAttribute("etrev", Domain.INT); version.addAttribute("how", Domain.INT); version.addAttribute("res", Domain.INT); version.addAttribute("bfile", Domain.KEY); version.addAttribute("brev", Domain.INT); version = new TableVersion(version, 1); version.removeAttribute("res"); version.addAttribute("resolvestate", Domain.INT, 7); addTable(table); table.addIndex("tfile", true); table.addIndex("ffile", true); table.addIndex("sfrev", true); Table resolve = table; // db.resolvex table = new Table("db.resolvex"); version = new TableVersion(table, 0); version.addAttributes(resolve.getVersion(0)); version = new TableVersion(version, 1); version.removeAttribute("res"); version.addAttribute("resolvestate", Domain.INT, 7); addTable(table); table.addIndex("tfile", true); table.addIndex("ffile", true); table.addIndex("sfrev", true); // db.have table = new Table("db.have"); version = new TableVersion(table, 0); version.addAttribute("cfile", Domain.KEY); version.addAttribute("dfile", Domain.KEY); version.addAttribute("rev", Domain.INT); version = new TableVersion(version, 1); version.addAttribute("type", Domain.INT); version = new TableVersion(version, 2); version.addAttribute("time", Domain.INT); version = new TableVersion(version, 2); addTable(table); table.addIndex("cfile", true); // db.label table = new Table("db.label"); version = new TableVersion(table, 0); version.addAttribute("name", Domain.KEY); version.addAttribute("dfile", Domain.KEY); // dfile instead of file for easy rename version.addAttribute("rev", Domain.INT); addTable(table); table.addIndex("name", true); table.addIndex("dfile", true); // db.locks table = new Table("db.locks"); version = new TableVersion(table, 0); version.addAttribute("dfile", Domain.KEY); version.addAttribute("client", Domain.KEY); version.addAttribute("user", Domain.KEY); version.addAttribute("islocked", Domain.INT); version = new TableVersion(version, 1); version.addAttribute("action", Domain.INT8, 3); version = new TableVersion(version, 2); version.addAttribute("change", Domain.INT); addTable(table); table.addIndex("dfile", true); table.addIndex("client", true); // db.archive table = new Table("db.archive"); version = new TableVersion(table, 0); version.addAttribute("afile", Domain.KEY); version.addAttribute("arev", Domain.KEY); version.addAttribute("dfile", Domain.KEY); version.addAttribute("rev", Domain.INT); version.addAttribute("atype", Domain.INT); version = new TableVersion(version, 1); addTable(table); table.addIndex("afile", true); table.addIndex("arev", false); table.addIndex("dfile", true); table.addIndex("rev", false); // db.archmap table = new Table("db.archmap"); version = new TableVersion(table, 0); version.addAttribute("afile", Domain.KEY); version.addAttribute("dfile", Domain.KEY); addTable(table); table.addIndex("afile", true); table.addIndex("dfile", true); // db.rev table = new Table("db.rev"); version = new TableVersion(table, 0); version.addAttribute("dfile", Domain.KEY); version.addAttribute("rev", Domain.INT); version.addAttribute("type", Domain.INT); version.addAttribute("ishead", Domain.INT); version.addAttribute("action", Domain.INT8); version.addAttribute("change", Domain.INT); version.addAttribute("date", Domain.DATE); version.addAttribute("afile", Domain.KEY); version.addAttribute("arev", Domain.KEY); version.addAttribute("atype", Domain.INT); version = new TableVersion(version, 1); version.addAttribute("digest", Domain.OCTET, 7); version = new TableVersion(version, 2); version.removeAttribute("ishead"); version = new TableVersion(version, 3); version.addAttribute("modtime", Domain.DATE, 6); version = new TableVersion(version, 4); version.addAttribute("traitlot", Domain.INT, 8); version = new TableVersion(version, 5); version.addAttribute("size", Domain.INT64, 8); version = new TableVersion(version, 6); version = new TableVersion(version, 7); version.addAttribute("islazy", Domain.INT, 10); version = new TableVersion(version, 8); // nothing changed here ... just for downgrade support. Weird. version = new TableVersion(version, 9); addTable(table); Table rev = table; // need a reference to this table for revdx, revhx, // revcx, revpx table.addIndex("dfile", true); table.addIndex("rev", false); // db.revcx table = new Table("db.revcx"); version = new TableVersion(table, 0); version.addAttribute("change", Domain.INT); version.addAttribute("dfile", Domain.KEY); version.addAttribute("rev", Domain.INT); version.addAttribute("action", Domain.INT8); addTable(table); table.addIndex("change", false); table.addIndex("dfile", true); // TODO: need to add missing versions, at least 4 in total // db.revdx table = new Table("db.revdx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); // db.revhx table = new Table("db.revhx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); // db.revpx table = new Table("db.revpx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); // db.revsx table = new Table("db.revsx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); // db.revbx table = new Table("db.revbx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); // db.revsh table = new Table("db.revsh"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); table.addIndex("change", false); // db.revux table = new Table("db.revux"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); // db.revtx (13.1) table = new Table("db.revtx"); for (int i = 0; i < 10; i++) { version = new TableVersion(table, i); version.addAttributes(rev.getVersion(i)); } addTable(table); table.addIndex("dfile", true); table.addIndex("rev", false); // db.working table = new Table("db.working"); version = new TableVersion(table, 0); version.addAttribute("cfile", Domain.KEY); version.addAttribute("dfile", Domain.KEY); version.addAttribute("client", Domain.KEY); version.addAttribute("user", Domain.KEY); version.addAttribute("hrev", Domain.INT); version.addAttribute("wrev", Domain.INT); version.addAttribute("type", Domain.INT); version.addAttribute("action", Domain.INT8); version.addAttribute("change", Domain.INT); version.addAttribute("modtime", Domain.DATE); version.addAttribute("islocked", Domain.INT); version = new TableVersion(version, 1); version = new TableVersion(version, 2); version.addAttribute("virtual", Domain.INT, 6); version = new TableVersion(version, 3); version.addAttribute("digest", Domain.OCTET); version = new TableVersion(version, 4); version.addAttribute("traitlot", Domain.INT); version = new TableVersion(version, 5); version.addAttribute("size", Domain.INT64, 13); version = new TableVersion(version, 6); version = new TableVersion(version, 7); version.addAttribute("tampered", Domain.INT); version = new TableVersion(version, 8); version.addAttribute("ctype", Domain.INT); version = new TableVersion(version, 9); version.addAttribute("mfile", Domain.KEY); version = new TableVersion(version, 10); version.addAttribute("status", Domain.INT); addTable(table); table.addIndex("cfile", true); Table working = table; // db.workingx table = new Table("db.workingx"); for (int i = 0; i < 11; i++) { version = new TableVersion(table, i); version.addAttributes(working.getVersion(i)); } addTable(table); table.addIndex("cfile", true); // db.traits table = new Table("db.traits"); version = new TableVersion(table, 0); version.addAttribute("traitlot", Domain.INT); version.addAttribute("name", Domain.KEY); version.addAttribute("type", Domain.INT); version.addAttribute("len", Domain.INT); version.addAttribute("value", Domain.OCTETS); addTable(table); table.addIndex("traitlot", true); table.addIndex("name", true); // db.trigger table = new Table("db.trigger"); version = new TableVersion(table, 0); version.addAttribute("seq", Domain.INT); version.addAttribute("name", Domain.KEY); version.addAttribute("mapflag", Domain.INT); version.addAttribute("dfile", Domain.KEY); version.addAttribute("action", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("trigger", Domain.INT, 4); version = new TableVersion(version, 2); version = new TableVersion(version, 3); version.addAttribute("tfile", Domain.KEY, 4); addTable(table); table.addIndex("seq", true); // Change data // db.change table = new Table("db.change"); version = new TableVersion(table, 0); version.addAttribute("change", Domain.INT); version.addAttribute("key", Domain.INT); version.addAttribute("client", Domain.KEY); version.addAttribute("user", Domain.KEY); version.addAttribute("date", Domain.DATE); version.addAttribute("status", Domain.INT8); version.addAttribute("desc", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("root", Domain.KEY); version = new TableVersion(version, 2); version = new TableVersion(version, 3); version.addAttribute("importer", Domain.TEXT); version.addAttribute("identity", Domain.TEXT); version = new TableVersion(version, 4); version.addAttribute("access", Domain.DATE); Table change = table; // save for changex addTable(table); table.addIndex("change", false); // db.changex table = new Table("db.changex"); version = new TableVersion(table, 0); version.addAttributes(change.getVersion(0)); version = new TableVersion(table, 1); version.addAttributes(change.getVersion(1)); version = new TableVersion(table, 2); version.addAttributes(change.getVersion(2)); version = new TableVersion(table, 3); version.addAttributes(change.getVersion(3)); version = new TableVersion(table, 4); version.addAttributes(change.getVersion(4)); addTable(table); table.addIndex("change", false); // db.desc table = new Table("db.desc"); version = new TableVersion(table, 0); version.addAttribute("key", Domain.INT); version.addAttribute("desc", Domain.TEXT); addTable(table); table.addIndex("key", false); // db.job table = new Table("db.job"); version = new TableVersion(table, 0); version.addAttribute("job", Domain.KEY); version.addAttribute("user", Domain.KEY); version.addAttribute("date", Domain.DATE); version.addAttribute("status", Domain.INT8); version.addAttribute("desc", Domain.TEXT); Table job = table; addTable(table); table.addIndex("job", true); // db.jobpend table = new Table("db.jobpend"); version = new TableVersion(table, 0); version.addAttributes(job.getVersion(0)); addTable(table); table.addIndex("job", true); table.addIndex("user", true); // db.jobdesc table = new Table("db.jobdesc"); version = new TableVersion(table, 0); version.addAttribute("job", Domain.INT); version.addAttribute("desc", Domain.TEXT); addTable(table); table.addIndex("job", true); // db.fix table = new Table("db.fix"); version = new TableVersion(table, 0); version.addAttribute("job", Domain.KEY); version.addAttribute("change", Domain.INT); version.addAttribute("date", Domain.DATE); version.addAttribute("stat992", Domain.INT8); version.addAttribute("client", Domain.KEY); version.addAttribute("user", Domain.KEY); version = new TableVersion(version, 1); version.removeAttribute("stat992"); version.addAttribute("status", Domain.KEY); Table fix = table; addTable(table); table.addIndex("job", true); table.addIndex("change", false); // db.fixrev table = new Table("db.fixrev"); version = new TableVersion(table, 0); version.addAttributes(fix.getVersion(0)); version = new TableVersion(table, 1); version.addAttributes(fix.getVersion(1)); addTable(table); table.addIndex("change", false); table.addIndex("job", true); // job bodies // db.boddate table = new Table("db.boddate"); version = new TableVersion(table, 0); version.addAttribute("key", Domain.KEY); version.addAttribute("attr", Domain.INT); version.addAttribute("date", Domain.DATE); addTable(table); table.addIndex("key", true); table.addIndex("attr", true); // db.bodtext table = new Table("db.bodtext"); version = new TableVersion(table, 0); version.addAttribute("key", Domain.KEY); version.addAttribute("attr", Domain.INT); version.addAttribute("text", Domain.TEXT); version = new TableVersion(version, 1); version.addAttribute("bulk", Domain.INT, 2); addTable(table); table.addIndex("key", true); table.addIndex("attr", true); // db.ixdate table = new Table("db.ixdate"); version = new TableVersion(table, 0); version.addAttribute("date", Domain.DATE); version.addAttribute("attr", Domain.INT); version.addAttribute("value", Domain.KEY); addTable(table); table.addIndex("date", true); table.addIndex("attr", true); table.addIndex("value", true); // db.ixtext table = new Table("db.ixtext"); version = new TableVersion(table, 0); version.addAttribute("word", Domain.KEY); version.addAttribute("attr", Domain.INT); version.addAttribute("value", Domain.KEY); addTable(table); table.addIndex("word", true); table.addIndex("attr", true); table.addIndex("value", true); // db.protect table = new Table("db.protect"); version = new TableVersion(table, 0); version.addAttribute("seq", Domain.INT); version.addAttribute("user", Domain.KEY); version.addAttribute("host", Domain.KEY); version.addAttribute("perm", Domain.INT8); version.addAttribute("mapflag", Domain.INT); version.addAttribute("dfile", Domain.KEY); version = new TableVersion(version, 1); version.addAttribute("group", Domain.INT, 1); version = new TableVersion(version, 2); version = new TableVersion(version, 3); version = new TableVersion(version, 4); version = new TableVersion(version, 5); version.addAttribute("subpath", Domain.KEY); version.addAttribute("update", Domain.DATE); addTable(table); table.addIndex("seq", true); // db.bodresolve table = new Table("db.bodresolve"); version = new TableVersion(table, 0); version.addAttribute("type", Domain.INT8); version.addAttribute("client", Domain.TEXT); version.addAttribute("tokey", Domain.TEXT); version.addAttribute("attr", Domain.INT); version.addAttribute("fromkey", Domain.TEXT); version.addAttribute("fromchange", Domain.INT); version.addAttribute("basekey", Domain.KEY); version.addAttribute("basechange", Domain.INT); addTable(table); table.addIndex("type", true); table.addIndex("client", true); table.addIndex("tokey", true); table.addIndex("attr", true); table.addIndex("fromkey", true); table.addIndex("fromchange", true); // db.message table = new Table("db.message"); version = new TableVersion(table, 0); version.addAttribute("lang", Domain.KEY); version.addAttribute("id", Domain.INT); version.addAttribute("msg", Domain.TEXT); addTable(table); table.addIndex("lang", true); table.addIndex("id", true); // db.monitor table = new Table("db.monitor"); version = new TableVersion(table, 0); version.addAttribute("id", Domain.INT); version.addAttribute("user", Domain.KEY); version.addAttribute("func", Domain.TEXT); version.addAttribute("args", Domain.TEXT); version.addAttribute("start", Domain.DATE); version.addAttribute("runstate", Domain.INT); version = new TableVersion(version, 1); version.addAttribute("client", Domain.KEY); version.addAttribute("host", Domain.TEXT); version.addAttribute("app", Domain.TEXT); version = new TableVersion(version, 2); version.addAttribute("lockinfo", Domain.TEXT); addTable(table); table.addIndex("id", true); } private static void addTable(final Table table) { tableNamesInOrder.add(table.getName()); tables.put(table.getName(), table); } private static void dumpSchema() { for (String name : tableNamesInOrder) { Table table = tables.get(name); System.out.println(table); } } public static void main(final String[] args) { if (args.length == 0) { dumpSchema(); } else { for (String arg : args) { Table table = tables.get(arg); if (table != null) { System.out.println(table); } else { System.out.println("Table " + arg + " unknown."); } } } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#22 | 23517 | Sven Erik Knop | Added table bodresolve | ||
#21 | 23494 | Sven Erik Knop |
Updated schema (partitially) to 2017.2 Still missing: graph depot schemas some rp (edge server) schemas |
||
#20 | 10702 | Sven Erik Knop | Updated schema for 2014.2 | ||
#19 | 8943 | Sven Erik Knop | Updated Schema for 2014.1 | ||
#18 | 8477 | Sven Erik Knop | Updated schema for 13.2/13.3 | ||
#17 | 8279 | Sven Erik Knop | Finalized schema updates for 2013.1 | ||
#16 | 8277 | Sven Erik Knop | Updated schema to 2013.1 | ||
#15 | 8237 | Sven Erik Knop | Adopted Nick Poole's changes to add PostgresSQL support. | ||
#14 | 8171 | Sven Erik Knop | More missing tables to the schema for 12.2. | ||
#13 | 8170 | Sven Erik Knop | Updated with 2012.2 schema. | ||
#12 | 8135 | Sven Erik Knop | Added new version of resolvex to the schema. | ||
#11 | 8118 | Sven Erik Knop | Added missing db.server to the schema. | ||
#10 | 8113 | Sven Erik Knop |
Updated to 12.1 schema. Added an example rename.ini config file. |
||
#9 | 8027 | Sven Erik Knop |
Moved exceptions to their own package. Enabled new Action FilepathRenamer (not fully tested yet). |
||
#8 | 8013 | Sven Erik Knop |
Rewrite of ClientUserRenamer. Now based on a saner model using a set of Actions instead of lots of state variables. Note that the counter currently does not work and simply returns 0 changes. |
||
#7 | 7991 | Sven Erik Knop | Add revbx (for archived files) to the schema of JournalReader. | ||
#6 | 7985 | Sven Erik Knop | Added 2011.1 Schema and updated the jar file. | ||
#5 | 7874 | Sven Erik Knop | Upgrade to 2010.2 including new JournalNotes. | ||
#4 | 7762 | Sven Erik Knop |
Added resolvex to the Schema. This is used when shelving integrated files. |
||
#3 | 7637 | Sven Erik Knop | Minor schema fix for db.domain for 2002 and earlier Perforce versions. | ||
#2 | 7627 | Sven Erik Knop | Added 9.2+ schema information (shelving) to the JournalReader. | ||
#1 | 7527 | Sven Erik Knop |
JournalReader, now in its proper place. Documentation to follow. |