-- Tables

/***** Object:  Table [VCLib].[T_SCHEMA] *****/
CREATE TABLE [T_SCHEMA]
(
    [SchemaName] varchar(255) NOT NULL,
    [Priority] int NOT NULL
)
ON [PRIMARY]
GO

-- Alters

ALTER TABLE [T_SCHEMA] WITH NOCHECK ADD CONSTRAINT [PK_T_SCHEMA]
PRIMARY KEY CLUSTERED ([SchemaName]) ON [PRIMARY]
GO




			  
ALTER TABLE [dbo].[T_ENTITIES] ADD [Schema] varchar(255)
GO

ALTER TABLE [dbo].[T_ENTITIES] WITH NOCHECK ADD CONSTRAINT [FK_T_SCHEMA_T_ENTITIES_Schema] FOREIGN KEY ([Schema]) REFERENCES [dbo].[T_SCHEMA] ([SchemaName])
GO

ALTER TABLE [dbo].[T_ADDITIONAL_ENTITIES] ADD [Schema] varchar(255)
GO

ALTER TABLE [dbo].[T_ADDITIONAL_ENTITIES] WITH NOCHECK ADD CONSTRAINT [FK_T_SCHEMA_T_ADDITIONAL_ENTITIES_Schema] FOREIGN KEY ([Schema]) REFERENCES [dbo].[T_SCHEMA] ([SchemaName])
GO


insert into [dbo].[T_SCHEMA](SchemaName,[Priority])
values('VCLib',5)
go

update T_ENTITIES
set [Schema] = 'VCLib'
where EntName in ('ACTIVE_FEATURE', 'ADDITIONAL_ENTITIES', 'BAE_ROLES', 'BASE_ACCESS_ENTRY', 'BASE_FEATURE_SETTINGS', 
'BASE_USERS', 'CHANGESET', 'CLIENT_MODULE_FEATURE', 'CLIENT_MODULES', 'CUSTOM_PROCESS_HANDLER', 'DATAFORM_EXTENSION', 
'DATAFORM_EXTENSION_ADDATTRIBUTE', 'DATAFORM_EXTENSION_ROLE', 'DATAFORM_TEMPLATE', 'DbServers', 'DIVISIONS', 'ENTITIES', 
'ENTITIES_ATTRIBUTES', 'ENTITY_ACCESS_ENTRY', 'ENTITY_ATTRIBUTE_ACCESS_ENTRY', 'ENTITY_ATTRIBUTES', 'ENUM_ACCESS_ENTRY', 
'ENUM_TYPES', 'ENUMS', 'EXTRA_TEMPLATE', 'EXTRA_UI_ACTION_PARAMS', 'EXTRA_UI_COMMAND', 'EXTRA_UI_COMMAND_ROLES', 'FILE', 
'FILES', 'HIDDEN_ATTRIBUTE', 'HOLDER', 'HOLDER_PARAMETER', 'HOLDER_PARAMETER_CUSTOM', 'HOLDER_STARTUP_CUSTOM', 'MACHINE_CONFIG', 
'MENU_COMMAND', 'PROCESS', 'PROCESS_ACCESS_ENTRY', 'ProcessDescription', 'ROLE_ATTRIBUTE_ACCESS', 'ROLE_CLIENT_MODULES', 
'ROLES', 'SCHEMA', 'SERVER_ROUTING_RULE', 'ShortcutCommand', 'TEMPLATE_FIELD', 'TEMPLATE_FIELD_VALUE', 'TRACE_EVENT', 
'USER_COLUMNS', 'USER_CONTEXTS', 'USER_SEARCHES', 'USERS_GROUP', 'USERS_ROLES', 'SERVERS', 'USER_CONFIG', 'USER_SESSIONS', 
'FILE_REPORT_MENU_ITEM', 'GENERIC_REPORT_MENU_ITEM', 'REPORT_MENU_ITEM', 'SIMPLE_REPORT_MENU_ITEM', 'AUTHENTICATION_AUDIT', 
'DELETED_OBJECT', 'DELETED_OBJECT_INFO', 'SECURITY_AUDIT', 'SECURITY_AUDIT_CHANGESET', 'SERVER_SESSION_AUDIT', 'UNITED_OBJECT', 
'UNITED_OBJECT_CHANGESET', 'BaseReport', 'Report', 'ReportFile', 'ReportFileFormat', 'ReportFileGroup', 'ReportFileParameter', 
'ReportKey', 'ReportRole', 'REPORTS_CONFIG', 'RSReport', 'TEMPLATE_OVERRIDE', 'DATAFORM_VALIDATION', 'VALIDATION_CONDITION', 
'ADD_DOCUMENT_LINK_MODULE', 'ADD_DOCUMENT_LINK_ROLES', 'ADDING_DOCUMENT', 'ADDING_DOCUMENT_FILE', 'NEWS_BOX', 
'NEWS_BOX_LINK_ADD_DOCUMENT', 'NEWS_BOX_LINK_MODULE', 'NEWS_BOX_LINK_ROLES', 'NEWS_BOX_LINK_USERS', 'NEWS_BOX_USERS_GROUP', 
'NEWS_LIST', 'JOB', 'JOB_SCHEDULE', 'JOB_STEP', 'JobExecutionError', 'RUN_PROCESS_OPERATION', 'SCHEDULER_OPERATION', 
'EXPORT_COLUMN', 'EXPORT_DATA', 'EXPORT_TABLE', 'EXPORT_TEMPLATE', 'DEPENDENCY_MODIFICATION', 'DEPENDENCY_MODIFICATION_ACTION', 
'OBJECT_MODIFICATION_ACTION', 'OBJECT_MODIFICATION_ACTION_PARAM', 'SINGLE_MODIFICATION_ACTION', 'ImportLog', 'ImportLogItem', 
'DICTIONARY_DEPEND', 'DICTIONARY_SERVICE_LINK', 'DICTIONARY_UPDATE', 'DICTIONARY_UPDATE_INFO', 'DICTIONARY_USER', 'SERVICE_USER', 
'GENERATOR_LINK', 'GENERATOR_PARAMS', 'GENERIC_REPORT', 'GENERIC_REPORT_FILE', 'GENERIC_REPORT_FILE_RIGHTS', 'GENERIC_REPORT_FOR_USER', 
'GENERIC_REPORT_FUNCTION', 'GENERIC_REPORT_GENERATOR', 'GENERIC_REPORT_GROUP', 'GENERIC_REPORT_GROUPBY', 'GENERIC_REPORT_MAIN', 
'GENERIC_REPORT_MAIN_ITEM', 'GENERIC_REPORT_RIGHTS', 'GENERIC_REPORT_TEMPLATE', 'GR_COMMON_GENERATOR', 'STATIC_GROUPS', 'CONTACT', 
'EMAIL_ADDRESS', 'EMAIL_ATTACHMENT', 'EMAIL_MESSAGE', 'EMAIL_RECIPIENT', 'EXPORT_ITEM', 'EXPORT_MESSAGE', 'EXPORT_OPERATION', 
'GENERIC_REPORT_ATTACHMENT', 'GR_ATTACHMENT_ITEM', 'REPORT_ATTACHMENT', 'CREDENTIALS', 'REMOTE_SERVER', 'DICTIONARY_SCHEDULE', 'DICTIONARY_ATTRIBUTE', 'DICTIONARY_ATTRIBUTE_KEY')
go
