From f2f0aa0cf9c5204c34068cf0028dd5c149c12975 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sat, 24 Apr 2021 14:12:36 +0300 Subject: [PATCH] activity scripts --- .../Scripts/001.Machine table.sql | 6 ++- .../Scripts/002.Activity tables.sql | 43 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/api/NetworkResurrector.Api.Domain.Data/Scripts/002.Activity tables.sql diff --git a/src/api/NetworkResurrector.Api.Domain.Data/Scripts/001.Machine table.sql b/src/api/NetworkResurrector.Api.Domain.Data/Scripts/001.Machine table.sql index 3f78b9c..a5a34b0 100644 --- a/src/api/NetworkResurrector.Api.Domain.Data/Scripts/001.Machine table.sql +++ b/src/api/NetworkResurrector.Api.Domain.Data/Scripts/001.Machine table.sql @@ -16,6 +16,10 @@ if not exists (select top 1 1 from Machine) begin insert into Machine(MachineName, FullMachineName, MACAddress, IPv4Address, [Description]) select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'Personal main development station' union - select '***REMOVED***', '***REMOVED***', '***REMOVED***', null, 'Main file server' + select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'Main file server' union + select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'Proxmox node' union + select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'Proxmox node' union + select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'VMware ESXi Hypervisor' union + select 'thin-ovm', 'thin-ovm.STAIND.RO', '***REMOVED***', '***REMOVED***', 'OpenMediaVault Server' end go \ No newline at end of file diff --git a/src/api/NetworkResurrector.Api.Domain.Data/Scripts/002.Activity tables.sql b/src/api/NetworkResurrector.Api.Domain.Data/Scripts/002.Activity tables.sql new file mode 100644 index 0000000..56fd423 --- /dev/null +++ b/src/api/NetworkResurrector.Api.Domain.Data/Scripts/002.Activity tables.sql @@ -0,0 +1,43 @@ +if not exists (select top 1 1 from sys.objects where name = 'Activity' and type = 'U') +begin + create table Activity + ( + ActivityId int identity(1, 1) constraint PK_Activity primary key, + ActivityCode varchar(30), + ActivityName varchar(130) + ) +end +go + +if not exists (select top 1 1 from Activity) +begin + insert into Activity (ActivityCode, ActivityName) + select 'WAKE', 'Wake machine' union + select 'PING', 'Ping machine' +end + +if not exists (select top 1 1 from sys.objects where name = 'ActivityLog' and type = 'U') +begin + create table ActivityLog + ( + ActivityLogId int identity(1, 1) constraint PK_ActivityLog primary key, + MachineId int constraint FK_ActivityLog_Machine foreign key references Machine(MachineId), + UserId int not null, + ActivityId int constraint FK_ActivityLog_Activity foreign key references Activity(ActivityId), + ActivityDate datetime not null, + Success bit not null, + Details varchar(2000) + ) +end +go + +if not exists (select top 1 1 from sys.objects where name = 'MachineCounters' and type = 'U') +begin + create table MachineCounters + ( + MachineId int constraint FK_MachineCounters_Machine foreign key references Machine(MachineId), + ActivityId int constraint FK_MachineCounters_Activity foreign key references Activity(ActivityId), + [Counter] int not null + ) +end +go \ No newline at end of file