activity scripts

master
Tudor Stanciu 2021-04-24 14:12:36 +03:00
parent 8ee5b5ca41
commit f2f0aa0cf9
2 changed files with 48 additions and 1 deletions

View File

@ -16,6 +16,10 @@ if not exists (select top 1 1 from Machine)
begin begin
insert into Machine(MachineName, FullMachineName, MACAddress, IPv4Address, [Description]) insert into Machine(MachineName, FullMachineName, MACAddress, IPv4Address, [Description])
select '***REMOVED***', '***REMOVED***', '***REMOVED***', '***REMOVED***', 'Personal main development station' union 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 end
go go

View File

@ -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