/** * Creates the SQL for the table holding global repository information. This includes the id of the hierarchy root * node. */ protected void initRepositorySQL() { TableMaker maker = new TableMaker(Model.REPOINFO_TABLE_NAME); maker.newColumn(Model.MAIN_KEY, ColumnType.NODEIDFK); maker.newColumn(Model.REPOINFO_REPONAME_KEY, ColumnType.SYSNAME); maker.table.addIndex(null, IndexType.UNIQUE, Model.REPOINFO_REPONAME_KEY); maker.postProcessRepository(); }
/** * Creates the SQL for the table holding hierarchy information. */ protected void initHierarchySQL() { TableMaker maker = new TableMaker(Model.HIER_TABLE_NAME); // if (separateMainTable) // maker.newColumn(model.MAIN_KEY, ColumnType.NODEIDFK); maker.newColumn(Model.MAIN_KEY, ColumnType.NODEID); Column column = maker.newColumn(Model.HIER_PARENT_KEY, ColumnType.NODEIDFKNULL); maker.newColumn(Model.HIER_CHILD_POS_KEY, ColumnType.INTEGER); maker.newColumn(Model.HIER_CHILD_NAME_KEY, ColumnType.STRING); maker.newColumn(Model.HIER_CHILD_ISPROPERTY_KEY, ColumnType.BOOLEAN); // notnull // if (!separateMainTable) maker.newFragmentFields(); maker.postProcess(); maker.postProcessHierarchy(); // if (!separateMainTable) // maker.postProcessIdGeneration(); maker.table.addIndex(Model.HIER_PARENT_KEY); maker.table.addIndex(Model.HIER_PARENT_KEY, Model.HIER_CHILD_NAME_KEY); // don't index parent+name+isprop, a simple isprop scan will suffice maker.table.addIndex(Model.MAIN_PRIMARY_TYPE_KEY); if (model.getRepositoryDescriptor().getSoftDeleteEnabled()) { maker.table.addIndex(Model.MAIN_IS_DELETED_KEY); } }
protected void initClusterSQL() { TableMaker maker = new TableMaker(Model.CLUSTER_NODES_TABLE_NAME); maker.newColumn(Model.CLUSTER_NODES_NODEID_KEY, ColumnType.CLUSTERNODE); maker.newColumn(Model.CLUSTER_NODES_CREATED_KEY, ColumnType.TIMESTAMP); maker.table.addIndex(null, IndexType.UNIQUE, Model.CLUSTER_NODES_NODEID_KEY); maker.postProcessClusterNodes(); maker = new TableMaker(Model.CLUSTER_INVALS_TABLE_NAME); maker.newColumn(Model.CLUSTER_INVALS_NODEID_KEY, ColumnType.CLUSTERNODE); maker.newColumn(Model.CLUSTER_INVALS_ID_KEY, ColumnType.NODEVAL); maker.newColumn(Model.CLUSTER_INVALS_FRAGMENTS_KEY, ColumnType.CLUSTERFRAGS); maker.newColumn(Model.CLUSTER_INVALS_KIND_KEY, ColumnType.TINYINT); maker.table.addIndex(Model.CLUSTER_INVALS_NODEID_KEY); maker.postProcessClusterInvalidations(); }
hierTable.addIndex(Model.MAIN_IS_VERSION_KEY); versionTable.addIndex(Model.VERSION_VERSIONABLE_KEY); proxyTable.addIndex(Model.PROXY_VERSIONABLE_KEY); proxyTable.addIndex(Model.PROXY_TARGET_KEY); int ftic = dialect.getFulltextIndexedColumns(); if (ftic == 1) { table.addIndex(indexName, IndexType.FULLTEXT, Model.FULLTEXT_FULLTEXT_KEY + suffix); } else if (ftic == 2) { table.addIndex(indexName, IndexType.FULLTEXT, Model.FULLTEXT_SIMPLETEXT_KEY + suffix, Model.FULLTEXT_BINARYTEXT_KEY + suffix);
protected Column newColumn(String columnName, ColumnType type) { Column column = table.addColumn(columnName, type, columnName, model); if (type == ColumnType.NODEID) { // column.setIdentity(true); if idGenPolicy identity column.setNullable(false); column.setPrimary(true); } if (type == ColumnType.NODEIDFK || type == ColumnType.NODEIDPK) { column.setNullable(false); column.setPrimary(true); } if (type == ColumnType.NODEIDFKMUL) { column.setNullable(false); table.addIndex(columnName); } if (type == ColumnType.NODEIDFK || type == ColumnType.NODEIDFKNP || type == ColumnType.NODEIDFKNULL || type == ColumnType.NODEIDFKMUL) { column.setReferences(database.getTable(Model.HIER_TABLE_NAME), Model.MAIN_KEY); } return column; }
SQLHelper.addColumn(table, targetColumn, ColumnType.STRING, nativeCase); table.addIndex(null, IndexType.MAIN_NON_PRIMARY, sourceColumn); SQLHelper helper = new SQLHelper(connection, table, directory.getDescriptor().getCreateTablePolicy()); boolean loadData = helper.setupTable();