Asset Manager Service (Microsoft Azure)
/****** Object: Table [dbo].[__constants] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__constants]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__constants](
[keyName] [nvarchar](255) NOT NULL,
[Value] [nvarchar](255) NOT NULL,
PRIMARY KEY CLUSTERED
(
[keyName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__dbVersion] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__dbVersion]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__dbVersion](
[Manufacturer] [nvarchar](50) NOT NULL,
[Version] [nvarchar](15) NOT NULL,
[WebServiceUrl] [nvarchar](255) NOT NULL
) ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__dynamicColumns] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: Table [dbo].[__dynamicFormColumns] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__dynamicFormColumns]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__dynamicFormColumns](
[__id] [uniqueidentifier] NOT NULL,
[TableName] [nvarchar](255) NOT NULL,
[ColumnName] [nvarchar](255) NULL,
[SqlDataType] [nvarchar](50) NULL,
[MaximumLength] [int] NOT NULL,
[NumericPrecision] [int] NOT NULL,
[NumericScale] [int] NOT NULL,
[ColumnPostfix] [nvarchar](255) NULL,
[DefaultValue] [nvarchar](max) NULL,
[CustomFormat] [nvarchar](255) NULL,
[ColumnIndex] [int] NOT NULL,
[IsRequired] [bit] NOT NULL,
[IsReadOnly] [bit] NOT NULL,
[IsVisible] [bit] NOT NULL,
[MinValue] [nvarchar](255) NULL,
[MaxValue] [nvarchar](255) NULL,
[RegularExpression] [nvarchar](max) NULL,
[IsDeleted] [bit] NOT NULL,
[IsLookupQuery] [bit] NOT NULL,
[LookupValues] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__dynamicForms] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__dynamicForms]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__dynamicForms](
[__id] [uniqueidentifier] NOT NULL,
[FormData] [nvarchar](max) NOT NULL,
[FormWidth] [int] NOT NULL,
[FormHeight] [int] NOT NULL,
CONSTRAINT [PK___dynamicForms] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__group] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__group]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__group](
[__id] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[__lastUpdate] [datetime2](7) NOT NULL,
[__lastUser] [nvarchar](255) NOT NULL,
CONSTRAINT [PK___group] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__hangFireJobs] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__hangFireJobs]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__hangFireJobs](
[__id] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[Description] [nvarchar](max) NULL,
[CronString] [nvarchar](255) NULL,
[IsEnabled] [bit] NOT NULL,
[SqlScript] [nvarchar](max) NOT NULL,
[LastExecution] [datetime] NULL,
[LastMessage] [nvarchar](max) NULL,
[__lastUpdate] [datetime] NOT NULL,
[__lastUser] [nvarchar](255) NOT NULL,
CONSTRAINT [PK____hangFi__0D7B1824008D60E5] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__languageAssignment] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__languageAssignment]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__languageAssignment](
[keyName] [nvarchar](50) NOT NULL,
[de] [nvarchar](max) NULL,
[en] [nvarchar](max) NULL,
PRIMARY KEY CLUSTERED
(
[keyName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__membership] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__membership]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__membership](
[__id] [uniqueidentifier] NOT NULL,
[groupId] [uniqueidentifier] NOT NULL,
[userId] [uniqueidentifier] NOT NULL,
CONSTRAINT [PK___membership] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__navigation] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__navigation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__navigation](
[propertyId] [uniqueidentifier] NOT NULL,
[propertyEnabled] [bit] NOT NULL,
[propertyName] [nvarchar](255) NOT NULL,
[propertyIcon] [nvarchar](255) NULL,
[query] [nvarchar](max) NULL,
[tableName] [nvarchar](255) NULL,
[parentPropertyId] [uniqueidentifier] NOT NULL,
[variables] [nvarchar](max) NULL,
[drilldowns] [nvarchar](max) NULL,
[hasHistory] [bit] NOT NULL,
[link] [nvarchar](max) NULL,
[favIcon] [nvarchar](max) NULL,
[blockedUsers] [nvarchar](max) NULL,
[propertyType] [nvarchar](255) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__navigationPermission] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__navigationPermission]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__navigationPermission](
[__id] [uniqueidentifier] NOT NULL,
[propertyId] [uniqueidentifier] NOT NULL,
[groupId] [uniqueidentifier] NOT NULL,
[permission] [int] NOT NULL,
CONSTRAINT [PK___navigationPermission] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object: Table [dbo].[__scheduledTasks] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: Table [dbo].[__user] Script Date: 24.02.2023 16:58:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[__user]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[__user](
[__id] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](255) NOT NULL,
[__lastUpdate] [datetime2](7) NOT NULL,
[__lastUser] [nvarchar](255) NOT NULL,
CONSTRAINT [PK___user] PRIMARY KEY CLUSTERED
(
[__id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___dynamicFormColumns___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF___dynamicFormColumns___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_MaximumLength]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_MaximumLength] DEFAULT ((0)) FOR [MaximumLength]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_NumericPrecision]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_NumericPrecision] DEFAULT ((0)) FOR [NumericPrecision]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_NumericScale]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_NumericScale] DEFAULT ((0)) FOR [NumericScale]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_IsNullable]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_IsNullable] DEFAULT ((1)) FOR [IsRequired]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_IsReadOnly]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_IsReadOnly] DEFAULT ((0)) FOR [IsReadOnly]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_IsVisible]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_IsVisible] DEFAULT ((1)) FOR [IsVisible]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF_dynamicFormColumns_IsDeleted]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF_dynamicFormColumns_IsDeleted] DEFAULT ((0)) FOR [IsDeleted]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___dynamicFormColumns_IsSqlQuery]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicFormColumns] ADD CONSTRAINT [DF___dynamicFormColumns_IsSqlQuery] DEFAULT ((0)) FOR [IsLookupQuery]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___dynamicForms_FormWidth]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicForms] ADD CONSTRAINT [DF___dynamicForms_FormWidth] DEFAULT ((700)) FOR [FormWidth]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___dynamicForms_FormHeight]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__dynamicForms] ADD CONSTRAINT [DF___dynamicForms_FormHeight] DEFAULT ((900)) FOR [FormHeight]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___group___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__group] ADD CONSTRAINT [DF___group___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___group___lastUpdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__group] ADD CONSTRAINT [DF___group___lastUpdate] DEFAULT (getdate()) FOR [__lastUpdate]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___hangFireTasks___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__hangFireJobs] ADD CONSTRAINT [DF___hangFireTasks___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___hangFireTasks_IsEnabled]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__hangFireJobs] ADD CONSTRAINT [DF___hangFireTasks_IsEnabled] DEFAULT ((1)) FOR [IsEnabled]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___hangFireTasks___lastUpdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__hangFireJobs] ADD CONSTRAINT [DF___hangFireTasks___lastUpdate] DEFAULT (getdate()) FOR [__lastUpdate]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___membership___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__membership] ADD CONSTRAINT [DF___membership___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___navigationPermission___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__navigationPermission] ADD CONSTRAINT [DF___navigationPermission___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___user___id]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__user] ADD CONSTRAINT [DF___user___id] DEFAULT (newid()) FOR [__id]
END
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DF___user___lastUpdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[__user] ADD CONSTRAINT [DF___user___lastUpdate] DEFAULT (getdate()) FOR [__lastUpdate]
END
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK___membership___group_GroupsId]') AND parent_object_id = OBJECT_ID(N'[dbo].[__membership]'))
ALTER TABLE [dbo].[__membership] WITH CHECK ADD CONSTRAINT [FK___membership___group_GroupsId] FOREIGN KEY([groupId])
REFERENCES [dbo].[__group] ([__id])
ON DELETE CASCADE
GO
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK___membership___group_GroupsId]') AND parent_object_id = OBJECT_ID(N'[dbo].[__membership]'))
ALTER TABLE [dbo].[__membership] CHECK CONSTRAINT [FK___membership___group_GroupsId]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK___membership___user_UsersId]') AND parent_object_id = OBJECT_ID(N'[dbo].[__membership]'))
ALTER TABLE [dbo].[__membership] WITH CHECK ADD CONSTRAINT [FK___membership___user_UsersId] FOREIGN KEY([userId])
REFERENCES [dbo].[__user] ([__id])
ON DELETE CASCADE
GO
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK___membership___user_UsersId]') AND parent_object_id = OBJECT_ID(N'[dbo].[__membership]'))
ALTER TABLE [dbo].[__membership] CHECK CONSTRAINT [FK___membership___user_UsersId]
GO