CREATE TABLE IF NOT EXISTS VIEWSORTCONTROL (
 VIEWID VARCHAR NOT NULL,
 WORKSPACEID VARCHAR NOT NULL,
 TABLEID VARCHAR NOT NULL,
 COLUMNID VARCHAR NOT NULL,
 ISASCENDING BOOLEAN,
 ISMODIFIED BOOLEAN,
 ISGLOBAL BOOLEAN NOT NULL,
 USERID VARCHAR,
 ISARCHIVED BOOLEAN NOT NULL,
 ARCHIVEDAT TIMESTAMP,
 ARCHIVEDBY VARCHAR,
 ID VARCHAR,
 CREATEDAT TIMESTAMP,
 UPDATEDAT TIMESTAMP,
 CREATEDBY VARCHAR,
 UPDATEDBY VARCHAR,
 PRIMARY KEY (ID, TABLEID)
) with "template=cache-partitioned, cache_name=ViewSortControl,key_type=model.ViewSortControlKey, value_type=model.ViewSortControl, affinity_key=tableId";
create index IF NOT EXISTS VIEWSORTCONTROL_tableId_isArchived_idx on VIEWSORTCONTROL (tableId, isArchived);
create index IF NOT EXISTS VIEWSORTCONTROL_viewId_columnId_idx on VIEWSORTCONTROL (viewId, columnId);