PostgreSQL script

You can use this script to create the metadata tables directly.

/*
**          Postgres
**
**  Create the basic OLAP metadata tables:
**    _AttributeFields
**    _CubeAccessControl
**    _Cubes
**    _CubesDimensions
**    _Dimensions
**    _DimensionLevelNames
**    _HierarchyLevelNames
**    _Jobs
**    _JobsParameters
**    _FactLoad
**    _FactLoadParameters
**    _Hierarchies
**    _HierarchyAttributes
**    _Parameters
**    _ScheduledJobs
**    _Sources
**    _Subsets
**    _ErrorText
**    _ErrorLogFactLoad
**    _ErrorLogElementLoad
**    _ErrorLogAttributeFill
**    _ErrorLogOther
**
**  Create the following views:
**    _ErrorLogOverview
**
*/

CREATE TABLE "_AttributeFields"(
    "DimensionName" varchar(50) NOT NULL,
    "TableId" int NOT NULL,
    "RelationalField" varchar(50) NULL,
    "FieldName" varchar(50) NOT NULL,
    "FieldDescription" varchar(150) NULL,
    "FieldType" char(1) NULL,
    "FieldWidth" int NOT NULL,
    "FieldDecimalPlaces" int NULL,
    "FieldOrderPosition" int NULL,
    "Comment" text NULL
);

CREATE TABLE "_CubeAccessControl"(
    "CubeName" varchar(50) NOT NULL,
    "AccessCubeName" varchar(50) NOT NULL,
    "Comment" text NULL
);

CREATE TABLE "_Cubes"(
    "CubeName" varchar(50) NOT NULL,
    "CubeDescription" varchar(150) NOT NULL,
    "Param1" varchar(150) NULL,
    "Param2" varchar(250) NULL,
    "AccessControl" int NOT NULL,
    "TransactionLog" int NOT NULL,
    "CubeType" char(1) NULL,
    "ExtendedProps" text NULL,
    "CubeRules" text NULL,
    "Comment" text NULL
);

CREATE TABLE "_CubesDimensions"(
    "CubeName" varchar(50) NOT NULL,
    "DimensionName" varchar(50) NOT NULL,
    "DimensionOrder" int NOT NULL,
    "MeasureDimension" int NOT NULL,
    "Comment" text NULL
);

CREATE TABLE "_Dimensions"(
    "DimensionName" varchar(50) NOT NULL,
    "DimensionDescription" varchar(150) NOT NULL,
    "SourceId" int NULL,
    "Param1" text NULL,
    "Param2" text NULL,
    "DimensionType" int NULL,
    "DefaultElement" varchar(71) NULL,
    "FlatView" int NOT NULL,
    "InvertedHierarchy" int NOT NULL,
    "AccessCube" varchar(50) NULL,
    "LoadFlags" bigint NULL,
    "ExtendedProps" text NULL,
    "Comment" text NULL
);

CREATE TABLE "_DimensionLevelNames"(
    "DimensionName" varchar(50) NOT NULL,
    "LevelNumber" int NULL,
    "LevelName" varchar(50) NULL,
    "Comment" text NULL
);

CREATE TABLE "_HierarchyLevelNames"(
       "DimensionName" varchar(50) NOT NULL,
       "HierarchyName" varchar(50) NOT NULL,
       "LevelNumber" int NOT NULL,
       "LevelName" varchar(50) NULL,
       "ColumnName" varchar(50) NULL,
       "Comment" text NULL
);

CREATE TABLE "_Jobs"(
    "JobId" bigint NOT NULL UNIQUE,
    "JobType" int NOT NULL,
    "JobObject" varchar(71) NOT NULL,
    "JobParameter" int NULL,
    "JobGroup" varchar(100) NULL,
    "Started" timestamp NULL,
    "Completed" timestamp NULL,
    "Status" int NULL,
    "Comment" text NULL
);

CREATE TABLE "_JobsParameters"(
    "JobParameter" bigint NOT NULL,
    "ParameterSet" int NOT NULL,
    "DimIdx" int NOT NULL,
    "ParameterValue" text NOT NULL,
    "Comment" text NULL
);

CREATE TABLE "_FactLoad"(
    "JobObject" varchar(50) NOT NULL UNIQUE,
    "CubeId" varchar(50) NOT NULL,
    "FactTable" text NULL,
    "FactChangesTable" text NULL,
    "FactLoadType" int NOT NULL,
    "ParameterId" int NOT NULL,
    "LastLoadedVersion" int NULL,
    "NewestVersionToLoad" int NULL,
    "SourceId" int NULL,
    "FactType" int NULL,
    "RelationalColumnName" varchar(50) NULL,
    "LoadFlags" bigint NULL,
    "Comment" text NULL
);

CREATE TABLE "_FactLoadParameters"(
    "Id" int NOT NULL,
    "DimIdx" int NOT NULL,
    "ColumnName" varchar(50) NULL,
    "TargetElement" varchar(71) NULL,
    "TargetElementUnknown" varchar(71) NULL, 
    "TargetElementMissing" varchar(71) NULL,
    "Comment" text NULL
);

CREATE TABLE "_Hierarchies"(
    "HierarchyName" varchar(50) NOT NULL,
    "HierarchyDescription" varchar(150) NOT NULL,
    "DimensionName" varchar(50) NOT NULL,
    "SourceId" int NULL,
    "HierarchyType" int NOT NULL,
    "Param1" text NULL,
    "Param2" text NULL,
    "DefaultElement" varchar(71) NULL,
    "ExtendedProps" text NULL,
    "Comment" text NULL	
);

CREATE TABLE "_HierarchyAttributes"(
       "DimensionName" varchar(50) NOT NULL,
       "HierarchyName" varchar(50) NOT NULL,
       "FieldName" varchar(50) NOT NULL,
       "ElementColumnName" varchar(50) NOT NULL,
       "AttributeColumnName" varchar(50) NOT NULL
);

CREATE TABLE "_Parameters"(
    "Id" bigint NOT NULL,
    "Key" varchar(50) NOT NULL,
    "DataType" int NOT NULL,
    "StringValue" text NULL,
    "IntegerValue" int NULL,
    "LinkId" bigint NULL,
    "Comment" text NULL,
    CONSTRAINT ID_KEY_PK PRIMARY KEY ("Id", "Key")
);

CREATE TABLE "_ScheduledJobs"(
    "Id" bigint NOT NULL UNIQUE,
    "JobType" int NOT NULL,
    "JobObject" varchar(71) NOT NULL,
    "JobParameter" int NULL,
    "Schedule" text NOT NULL,
    "Scheduled" int NOT NULL,
    "Disabled" int NOT NULL,
    "Comment" text NULL	
);

CREATE TABLE "_Sources"(
    "SourceId" int NOT NULL,
    "SourceType" int NOT NULL,
    "ConnectionParameters" text NULL,
    "Comment" text NULL
);

CREATE TABLE "_Subsets"(
    "DimName" varchar(50) NOT NULL,
    "SubsetName" varchar(50) NOT NULL,
    "SubsetKind" int NOT NULL,
    "SubsetCategory" int NOT NULL,
    "SubsetTable" text NOT NULL,
    "Comment" text NULL
);

CREATE TABLE "_ErrorText"(
    "ErrorCode" int NOT NULL,
    "LanguageRegion" varchar(15) NOT NULL,
    "Text" text NULL
);

CREATE TABLE "_ErrorLogFactLoad"(
    "JobId" bigint NOT NULL,
    "ErrorCode" int NOT NULL,
    "ErrorDimIdx" int NULL,
    "ErrorDimName" varchar(50) NULL,
    "Element00" varchar(256) NULL,
    "Element01" varchar(256) NULL,
    "Element02" varchar(256) NULL,
    "Element03" varchar(256) NULL,
    "Element04" varchar(256) NULL,
    "Element05" varchar(256) NULL,
    "Element06" varchar(256) NULL,
    "Element07" varchar(256) NULL,
    "Element08" varchar(256) NULL,
    "Element09" varchar(256) NULL,
    "Element10" varchar(256) NULL,
    "Element11" varchar(256) NULL,
    "Element12" varchar(256) NULL,
    "Element13" varchar(256) NULL,
    "Element14" varchar(256) NULL,
    "Element15" varchar(256) NULL,
    "Element16" varchar(256) NULL,
    "Element17" varchar(256) NULL,
    "Element18" varchar(256) NULL,
    "Element19" varchar(256) NULL,
    "Element20" varchar(256) NULL,
    "Element21" varchar(256) NULL,
    "Element22" varchar(256) NULL,
    "Element23" varchar(256) NULL,
    "Element24" varchar(256) NULL,
    "Element25" varchar(256) NULL,
    "Element26" varchar(256) NULL,
    "Element27" varchar(256) NULL,
    "Element28" varchar(256) NULL,
    "Element29" varchar(256) NULL,
    "ElementCaption00" varchar(256) NULL,
    "ElementCaption01" varchar(256) NULL,
    "ElementCaption02" varchar(256) NULL,
    "ElementCaption03" varchar(256) NULL,
    "ElementCaption04" varchar(256) NULL,
    "ElementCaption05" varchar(256) NULL,
    "ElementCaption06" varchar(256) NULL,
    "ElementCaption07" varchar(256) NULL,
    "ElementCaption08" varchar(256) NULL,
    "ElementCaption09" varchar(256) NULL,
    "ElementCaption10" varchar(256) NULL,
    "ElementCaption11" varchar(256) NULL,
    "ElementCaption12" varchar(256) NULL,
    "ElementCaption13" varchar(256) NULL,
    "ElementCaption14" varchar(256) NULL,
    "ElementCaption15" varchar(256) NULL,
    "ElementCaption16" varchar(256) NULL,
    "ElementCaption17" varchar(256) NULL,
    "ElementCaption18" varchar(256) NULL,
    "ElementCaption19" varchar(256) NULL,
    "ElementCaption20" varchar(256) NULL,
    "ElementCaption21" varchar(256) NULL,
    "ElementCaption22" varchar(256) NULL,
    "ElementCaption23" varchar(256) NULL,
    "ElementCaption24" varchar(256) NULL,
    "ElementCaption25" varchar(256) NULL,
    "ElementCaption26" varchar(256) NULL,
    "ElementCaption27" varchar(256) NULL,
    "ElementCaption28" varchar(256) NULL,
    "ElementCaption29" varchar(256) NULL,
    "FactType" int NULL,
    "ValueNumeric" real NULL,
    "ValueString" text NULL,
    "Comment" text NULL
);

CREATE TABLE "_ErrorLogElementLoad"(
    "JobId" bigint NOT NULL,
    "ErrorCode" int NOT NULL,
    "Dimension" varchar(256) NULL,
    "DimensionCaption" varchar(256) NULL,
    "Hierarchy" varchar(256) NULL,
    "HierarchyCaption" varchar(256) NULL,
    "Element" varchar(256) NULL,
    "ElementCaption" varchar(256) NULL,
    "ElementType" varchar(256) NULL,
    "ParentElement" varchar(256) NULL,
    "ParentElementCaption" varchar(256) NULL,
    "Weight" real NULL,
    "Comment" text NULL
);

CREATE TABLE "_ErrorLogAttributeFill" (
    "JobId" bigint NOT NULL,
    "ErrorCode" int NOT NULL,
    "Dimension" varchar(256) NULL,
    "DimensionCaption" varchar(256) NULL,
    "Hierarchy" varchar(256) NULL,
    "HierarchyCaption" varchar(256) NULL,
    "Element" varchar(256) NULL,
    "ElementCaption" varchar(256) NULL,
    "TableId" int NULL,
    "AttributeFieldName" varchar(256) NULL,
    "AttributeDataValue" varchar(512) NULL,
    "AttributeFieldType" varchar(16) NULL,
    "AttributeFieldLength" int NULL,
    "AttributeFieldDecimals" int NULL,
    "Comment" text NULL
);

CREATE TABLE "_ErrorLogOther"(    
    "JobId" bigint NOT NULL,
    "ErrorCode" int NOT NULL,
    "ObjectKind" varchar(256) NULL,
    "ObjectName" varchar(256) NULL,
    "ObjectCaption" varchar(256) NULL,
    "ErrorText" text NULL
);

CREATE VIEW "_ErrorLogOverview" AS
SELECT "JobId", '_ErrorLogFactLoad' AS "Table", COUNT(*) AS "Row Count" FROM "_ErrorLogFactLoad"
    GROUP BY "JobId"
UNION
SELECT "JobId", '_ErrorLogElementLoad' AS "Table", COUNT(*) AS "Row Count" FROM "_ErrorLogElementLoad"
    GROUP BY "JobId"
UNION
SELECT "JobId", '_ErrorLogAttributeFill' AS "Table", COUNT(*) AS "Row Count" FROM "_ErrorLogAttributeFill"
    GROUP BY "JobId"
UNION
SELECT "JobId", '_ErrorLogOther' AS "Table", COUNT(*) AS "Row Count" FROM "_ErrorLogOther"
    GROUP BY "JobId";