Class CreateWholeSchemaVersion


  • public class CreateWholeSchemaVersion
    extends Object
    Creates the WHOLE_SCHEMA_VERSION table. Although this is an administration table, for least privileges it is stored in the data schema, not the admin schema. This makes it easier to keep data private so that tenants aren't able to see the schema version used by other tenants, but do get to see their own tenant version. This is because the table will contain only one row. For Db2 multitenant, all tenants in a schema share the same version, so we don't need to add mt_id, making things a little simpler.

    • Constructor Detail

      • CreateWholeSchemaVersion

        public CreateWholeSchemaVersion()
    • Method Detail

      • buildTableDef

        public static Table buildTableDef​(PhysicalDataModel dataModel,
                                          String schemaName,
                                          boolean addTags)
        Builds the definition of the WHOLE_SCHEMA_VERSION table in the schema identified by schemaName
        Parameters:
        dataModel -
        schemaName -
        addTags -
        Returns:
        the Table definition
      • createTableIfNeeded

        public static void createTableIfNeeded​(String schemaName,
                                               IDatabaseAdapter target)
        Create the WHOLE_SCHEMA_VERSION table. The table is created in the target data schema, not the admin schema.
        Parameters:
        schemaName -
        target -
      • dropTable

        public static void dropTable​(String schemaName,
                                     IDatabaseAdapter target)
        Drop the WHOLE_SCHEMA_VERSION table if it exists in the given schema
        Parameters:
        schemaName -
        target -
      • grantPrivilegesTo

        public static void grantPrivilegesTo​(IDatabaseAdapter target,
                                             String schemaName,
                                             String groupName,
                                             String toUser)
        Grant the user privileges so that the row from this table can be read by the $healthcheck custom operation.
        Parameters:
        target -
        groupName -
        toUser -