Creating a Test Database

From floodzilla-wiki
Revision as of 23:49, 20 November 2020 by DaveSanderman (talk | contribs) (→‎Creating a Test Database)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creating a Test Database

For now this is just a record of the steps I took when bringing up a new database for testing/staging purposes. Eventually it will be fleshed out into a real document.


use master
go
CREATE LOGIN SVPATest with password='<PASSWORD>';

-----

create database using sql studio
- all default params

set configuration in azure portal
- serverless
- max size 32GB

------
connect to SVPATest db using SVPAAdmin

create user SVPATest from login SVPATest
go
exec sp_addrolemember 'db_owner', 'SVPATest'
go

------
connect to SVPATest db using SVPATest (note: SVPATest user can't enumerate databases)

use table-and-sproc-generating script from existing db
- do i want to check this in someplace when all is said and done?

initialize data:
INSERT [dbo].[DeviceTypes] ([DeviceTypeId], [DeviceTypeName]) VALUES (1, N'SVPA')
INSERT [dbo].[DeviceTypes] ([DeviceTypeId], [DeviceTypeName]) VALUES (2, N'USGS')
INSERT [dbo].[DeviceTypes] ([DeviceTypeId], [DeviceTypeName]) VALUES (3, N'Virtual Device')
INSERT [dbo].[DeviceTypes] ([DeviceTypeId], [DeviceTypeName]) VALUES (4, N'Senix')
GO

------

!!!SET UP FloodzillaWeb\developer.settings.json to point to new database

run /Testing/InitializeDatabase

stop and restart web site

log in as first user

change password

edit region to set up initial values

log off

create a new user to use for ongoing testing

log in as first user

update testing user (set as Admin if so desired)

log in as testing user

create a virtual device

create a testing location

!!!SET UP SenixListener\developer.settings.json to point to new database

run SenixListener and SenixPost and verify SensorReadings and SenixListenerLogs are getting filled correctly



Tables which need initial data

The following tables need initial data from the production database:

  • DeviceTypes
  • UsgsSites