As far as I can tell, this works. This is in a migration’s upgrade() method, after I CREATE EXTENSION and ALTER TABLE:
// Get the model
EOModel
model = ERXModelGroup.defaultGroup().modelNamed("Ident");
// Get jdbc2Info dictionary from connectionDictionary
NSMutableDictionary<String, Object>
overrides =
((NSDictionary<String, Object>) model
.connectionDictionary().valueForKey("jdbc2Info"))
.mutableClone();
// Build the value we want for the typeInfo.citext key
NSDictionary<String, Object>
citext =
NSPropertyListSerialization
.dictionaryForString("{defaultJDBCType = (\"OTHER\"); createParams = \"0\";
maxScale = \"0\"; minScale = \"0\"; isNullable = \"T\"; isSearchable = \"T\"; precision = \"0\"; }");
// Add the citext entry to overrides
overrides.takeValueForKeyPath(citext,
"typeInfo.citext");
// Apply the overrides
EODatabaseContext.forceConnectionWithModel(model,
overrides, editingContext);
Any comments on the safety/desirability of this approach, or where it sits on the scale of awful hacks?
Next up, PlugIn subclass.