@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { DBHelper.createDerbyTableIfNotExists( "CREATE TABLE users ( " + "user_id VARCHAR(256), " + "tenant_id VARCHAR(64), " + "profile BLOB )", dbConnectionPool); } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { DBHelper.createDerbyTableIfNotExists( "CREATE TABLE sensitiveFields ( " + "tenant_id VARCHAR(64), " + "cluster_id VARCHAR(255), " + "fields BLOB )", dbConnectionPool); } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { LOG.warn("Initializing Derby DB... Tables are not optimized for performance."); boolean created = DBHelper.createDerbyTableIfNotExists("CREATE TABLE nodes ( " + "cluster_id BIGINT, " + "id VARCHAR(64), " + "node BLOB, " + "PRIMARY KEY (id) )", dbConnectionPool ); if (created) { DBHelper.createDerbyIndex(dbConnectionPool, "nodes_cluster_index", "nodes", "cluster_id", "id"); } } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { boolean created = DBHelper.createDerbyTableIfNotExists( "CREATE TABLE pluginMeta (" + "tenant_id VARCHAR(255), " + "plugin_type VARCHAR(16), " + "plugin_name VARCHAR(255), " + "resource_type VARCHAR(255), " + "name VARCHAR(255), " + "version INTEGER, " + "live BOOLEAN, " + "slated BOOLEAN, " + "deleted BOOLEAN, " + "create_time TIMESTAMP," + "delete_time TIMESTAMP," + "PRIMARY KEY(tenant_id, plugin_type, plugin_name, resource_type, name, version) )", dbConnectionPool); if (created) { DBHelper.createDerbyIndex(dbConnectionPool, "plugin_meta_index", "pluginMeta", "tenant_id", "plugin_type", "plugin_name", "resource_type", "name", "version"); } } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { for (BaseEntityStoreView.EntityType entityType : BaseEntityStoreView.EntityType.values()) { String entityName = entityType.getId(); // immune to sql injection since it comes from the enum String createString = "CREATE TABLE " + entityName + "s ( name VARCHAR(255), version BIGINT, tenant_id VARCHAR(255), " + entityName + " BLOB, PRIMARY KEY (tenant_id, name, version))"; DBHelper.createDerbyTableIfNotExists(createString, dbConnectionPool); } } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { DBHelper.createDerbyTableIfNotExists( "CREATE TABLE tenants ( " + "id VARCHAR(255), " + "name VARCHAR(255), " + "workers INT, " + "deleted BOOLEAN, " + "create_time TIMESTAMP, " + "delete_time TIMESTAMP, " + "tenant BLOB )", dbConnectionPool); } // add superadmin if it doesn't exist Tenant superadminTenant = getTenantByName(Constants.SUPERADMIN_TENANT); if (superadminTenant == null) { writeTenant(Tenant.DEFAULT_SUPERADMIN); } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { DBHelper.createDerbyTableIfNotExists("CREATE TABLE provisioners (" + "id VARCHAR(255), " + "last_heartbeat TIMESTAMP, " + "capacity_total INTEGER, " + "capacity_free INTEGER, " + "provisioner BLOB, " + "PRIMARY KEY (id) )", dbConnectionPool); DBHelper.createDerbyIndex(dbConnectionPool, "provisioners_heartbeat_index", "provisioners", "last_heartbeat"); DBHelper.createDerbyTableIfNotExists("CREATE TABLE provisionerWorkers (" + "provisioner_id VARCHAR(255), " + "tenant_id VARCHAR(255), " + "num_assigned INTEGER, " + "num_live INTEGER, " + "PRIMARY KEY (tenant_id, provisioner_id) )", dbConnectionPool); } }
@Override protected void startUp() throws Exception { if (dbConnectionPool.isEmbeddedDerbyDB()) { LOG.warn("Initializing Derby DB... Tables are not optimized for performance.");