From 239fae4c232049aa5f08fbe1abb85b0350b7b061 Mon Sep 17 00:00:00 2001 From: Carl Sixsmith Date: Fri, 31 May 2024 14:59:14 +0100 Subject: [PATCH] Remove seeds from the initializer and add to a script instead --- db/seed/001_development_seed.sql | 236 ++++++++++++++++++ db/seed/README.md | 8 + .../ApplicationDbContextInitializer.cs | 145 +---------- .../DataSeeds/Development/Locations.json | 91 ------- .../DataSeeds/Development/Users.json | 30 --- .../Persistence/Initializers/SeedingData.cs | 161 ------------ src/Server.UI/Program.cs | 1 - 7 files changed, 246 insertions(+), 426 deletions(-) create mode 100644 db/seed/001_development_seed.sql create mode 100644 db/seed/README.md delete mode 100644 src/Infrastructure/Persistence/DataSeeds/Development/Locations.json delete mode 100644 src/Infrastructure/Persistence/DataSeeds/Development/Users.json delete mode 100644 src/Infrastructure/Persistence/Initializers/SeedingData.cs diff --git a/db/seed/001_development_seed.sql b/db/seed/001_development_seed.sql new file mode 100644 index 00000000..51a4dfc8 --- /dev/null +++ b/db/seed/001_development_seed.sql @@ -0,0 +1,236 @@ + +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.', N'CFO', N'Root tenant for Creating Future Opportunities', N'2024-05-31 12:30:38.3849332', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.', N'CFO Evolution', N'Top level tenant for Evolution Programme', N'2024-05-31 12:30:38.3850497', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.1.', N'Alpha', N'Alpha', N'2024-05-31 12:30:38.3850635', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.2.', N'Bravo', N'Top level tenant for provider Bravo', N'2024-05-31 12:30:38.3850637', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.2.1.', N'Bravo (A)', N'Bravo (A)', N'2024-05-31 12:30:38.3850640', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.2.2.', N'Bravo (B)', N'Bravo (B)', N'2024-05-31 12:30:38.3850641', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.2.3.', N'Bravo (C)', N'Bravo (C)', N'2024-05-31 12:30:38.3850643', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.3.', N'Charlie', N'Charlie', N'2024-05-31 12:30:38.3850645', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.4.', N'Delta', N'Top level tenant for Delta', N'2024-05-31 12:30:38.3850647', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.4.1.', N'Delta (A)', N'Delta (A)', N'2024-05-31 12:30:38.3850648', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.4.2.', N'Delta (B)', N'Delta (B)', N'2024-05-31 12:30:38.3850650', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.5.', N'Echo', N'Echo', N'2024-05-31 12:30:38.3850651', null, null, null); +INSERT INTO CatsDb.dbo.Tenant (Id, Name, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'1.1.6.', N'Foxtrot', N'Foxtrot', N'2024-05-31 12:30:38.3850653', null, null, null); + +GO + +SET IDENTITY_INSERT ApplicationRole ON; + +INSERT INTO dbo.ApplicationRole (Id, Description, Name, NormalizedName, ConcurrencyStamp) VALUES (1, N'Admin Group', N'Admin', N'ADMIN', N'e6340a9c-8144-4f9d-8489-2e21af06bc56'); +INSERT INTO dbo.ApplicationRole (Id, Description, Name, NormalizedName, ConcurrencyStamp) VALUES (2, N'Basic User Group', N'Basic', N'BASIC', N'67781ee3-3fbc-4214-bec7-3fba39ea0eb3'); + +SET IDENTITY_INSERT ApplicationRole OFF; + +GO + +SET IDENTITY_INSERT ApplicationRoleClaim ON; + +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (1, null, null, 1, N'Permission', N'Permissions.AuditTrails.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (2, null, null, 1, N'Permission', N'Permissions.AuditTrails.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (3, null, null, 1, N'Permission', N'Permissions.AuditTrails.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (4, null, null, 1, N'Permission', N'Permissions.Dashboards.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (5, null, null, 1, N'Permission', N'Permissions.Dictionaries.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (6, null, null, 1, N'Permission', N'Permissions.Dictionaries.Create'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (7, null, null, 1, N'Permission', N'Permissions.Dictionaries.Edit'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (8, null, null, 1, N'Permission', N'Permissions.Dictionaries.Delete'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (9, null, null, 1, N'Permission', N'Permissions.Dictionaries.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (10, null, null, 1, N'Permission', N'Permissions.Dictionaries.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (11, null, null, 1, N'Permission', N'Permissions.Dictionaries.Import'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (12, null, null, 1, N'Permission', N'Permissions.Enrolments.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (13, null, null, 1, N'Permission', N'Permissions.Hangfire.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (14, null, null, 1, N'Permission', N'Permissions.Hangfire.Jobs'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (15, null, null, 1, N'Permission', N'Permissions.Logs.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (16, null, null, 1, N'Permission', N'Permissions.Logs.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (17, null, null, 1, N'Permission', N'Permissions.Logs.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (18, null, null, 1, N'Permission', N'Permissions.Logs.Purge'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (19, null, null, 1, N'Permission', N'Permissions.RoleClaims.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (20, null, null, 1, N'Permission', N'Permissions.RoleClaims.Create'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (21, null, null, 1, N'Permission', N'Permissions.RoleClaims.Edit'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (22, null, null, 1, N'Permission', N'Permissions.RoleClaims.Delete'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (23, null, null, 1, N'Permission', N'Permissions.RoleClaims.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (24, null, null, 1, N'Permission', N'Permissions.Roles.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (25, null, null, 1, N'Permission', N'Permissions.Roles.Create'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (26, null, null, 1, N'Permission', N'Permissions.Roles.Edit'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (27, null, null, 1, N'Permission', N'Permissions.Roles.Delete'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (28, null, null, 1, N'Permission', N'Permissions.Roles.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (29, null, null, 1, N'Permission', N'Permissions.Roles.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (30, null, null, 1, N'Permission', N'Permissions.Roles.Import'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (31, null, null, 1, N'Permission', N'Permissions.Roles.Permissions'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (32, null, null, 1, N'Permission', N'Permissions.Roles.Navigation'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (33, null, null, 1, N'Permission', N'Permissions.Tenants.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (34, null, null, 1, N'Permission', N'Permissions.Tenants.Create'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (35, null, null, 1, N'Permission', N'Permissions.Tenants.Edit'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (36, null, null, 1, N'Permission', N'Permissions.Tenants.Delete'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (37, null, null, 1, N'Permission', N'Permissions.Tenants.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (38, null, null, 1, N'Permission', N'Permissions.Tenants.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (39, null, null, 1, N'Permission', N'Permissions.Users.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (40, null, null, 1, N'Permission', N'Permissions.Users.Create'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (41, null, null, 1, N'Permission', N'Permissions.Users.Edit'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (42, null, null, 1, N'Permission', N'Permissions.Users.Delete'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (43, null, null, 1, N'Permission', N'Permissions.Users.Search'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (44, null, null, 1, N'Permission', N'Permissions.Users.Import'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (45, null, null, 1, N'Permission', N'Permissions.Dictionaries.Export'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (46, null, null, 1, N'Permission', N'Permissions.Users.ManageRoles'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (47, null, null, 1, N'Permission', N'Permissions.Users.RestPassword'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (48, null, null, 1, N'Permission', N'Permissions.Users.Active'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (49, null, null, 1, N'Permission', N'Permissions.Users.Permissions'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (50, null, null, 2, N'Permission', N'Permissions.AuditTrails.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (51, null, null, 2, N'Permission', N'Permissions.Dashboards.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (52, null, null, 2, N'Permission', N'Permissions.Dictionaries.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (53, null, null, 2, N'Permission', N'Permissions.Hangfire.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (54, null, null, 2, N'Permission', N'Permissions.Logs.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (55, null, null, 2, N'Permission', N'Permissions.RoleClaims.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (56, null, null, 2, N'Permission', N'Permissions.Roles.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (57, null, null, 2, N'Permission', N'Permissions.Tenants.View'); +INSERT INTO dbo.ApplicationRoleClaim (Id, Description, [Group], RoleId, ClaimType, ClaimValue) VALUES (58, null, null, 2, N'Permission', N'Permissions.Users.View'); + +SET IDENTITY_INSERT ApplicationRoleClaim OFF; + +GO + +SET IDENTITY_INSERT ApplicationUser ON; + +INSERT INTO dbo.ApplicationUser (Id, DisplayName, Provider, TenantId, TenantName, ProfilePictureDataUrl, IsActive, IsLive, RefreshToken, RefreshTokenExpiryTime, SuperiorId, UserName, NormalizedUserName, Email, NormalizedEmail, EmailConfirmed, PasswordHash, SecurityStamp, ConcurrencyStamp, PhoneNumber, PhoneNumberConfirmed, TwoFactorEnabled, LockoutEnd, LockoutEnabled, AccessFailedCount) VALUES (1, N'Support Worker', N'Local', N'1.', N'CFO', N'https://avatars.githubusercontent.com/u/9332472?s=400&u=73c208bf07ba967d5407aae9068580539cfc80a2&v=4', 1, 0, null, N'0001-01-01 00:00:00.0000000', null, N'support.worker@justice.gov.uk', N'SUPPORT.WORKER@JUSTICE.GOV.UK', N'support.worker@justice.gov.uk', N'SUPPORT.WORKER@JUSTICE.GOV.UK', 1, N'AQAAAAIAAYagAAAAEAVdTO5H3lP4OTTB1CzJun94RqDWYMHHxDYYLCcf3zER/g2IRxukunJEOYggb0xWZg==', N'5OAC7CKMMFBY3SMD4MZ7GKVDZRZ7CVUZ', N'49dbf347-de6b-4579-997b-3cfd4d79afa0', null, 0, 0, null, 1, 0); + +SET IDENTITY_INSERT ApplicationUser OFF; + +GO + +INSERT INTO dbo.ApplicationUserRole (UserId, RoleId) VALUES (1, 1); + + +GO + +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution1', 1, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'North West', N'1.', N'2024-05-31 12:30:38.9702330', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution2', 2, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'North East', N'1.', N'2024-05-31 12:30:38.9702326', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution3', 3, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'Yorkshire and Humberside', N'1.', N'2024-05-31 12:30:38.9702322', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution4', 4, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'West Midlands', N'1.', N'2024-05-31 12:30:38.9702315', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution5', 5, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'East Midlands', N'1.', N'2024-05-31 12:30:38.9702311', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution6', 6, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'East Of England', N'1.', N'2024-05-31 12:30:38.9702308', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution7', 7, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'London', N'1.', N'2024-05-31 12:30:38.9702304', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution8', 8, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'South West', N'1.', N'2024-05-31 12:30:38.9702300', null, null, null); +INSERT INTO dbo.Contract (Id, LotNumber, LifetimeStart, LifetimeEnd, Description, TenantId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (N'Evolution9', 9, N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', N'South East', N'1.', N'2024-05-31 12:30:38.9702153', null, null, null); + +GO + +SET IDENTITY_INSERT KeyValue ON; + +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (1, N'ReferralSource', N'CFO Evolution Provider', N'CFO Evolution Provider', N'A referral source', N'2024-05-31 12:30:42.7615462', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (2, N'ReferralSource', N'Probation', N'Probation', N'A referral source', N'2024-05-31 12:30:42.7615457', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (3, N'ReferralSource', N'Approved Premises', N'Approved Premises', N'A referral source', N'2024-05-31 12:30:42.7615453', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (4, N'ReferralSource', N'CAS2', N'CAS2', N'A referral source', N'2024-05-31 12:30:42.7615451', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (5, N'ReferralSource', N'CAS3', N'CAS3', N'A referral source', N'2024-05-31 12:30:42.7615449', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (6, N'ReferralSource', N'Custodial Family Services', N'Custodial Family Services', N'A referral source', N'2024-05-31 12:30:42.7615448', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (7, N'ReferralSource', N'CRS - Women', N'CRS- Women', N'A referral source', N'2024-05-31 12:30:42.7615445', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (8, N'ReferralSource', N'CRS - Personal Wellbeing', N'CRS- Personal Wellbeing', N'A referral source', N'2024-05-31 12:30:42.7615443', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (9, N'ReferralSource', N'CRS - Dependency & Recovery', N'CRS- Dependency & Recovery', N'A referral source', N'2024-05-31 12:30:42.7615441', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (10, N'ReferralSource', N'CRS - Accommodation', N'CRS- Accommodation', N'A referral source', N'2024-05-31 12:30:42.7615439', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (11, N'ReferralSource', N'Custody staff', N'Custody staff', N'A referral source', N'2024-05-31 12:30:42.7615436', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (12, N'ReferralSource', N'New Futures Network', N'New Futures Network', N'A referral source', N'2024-05-31 12:30:42.7615428', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (13, N'ReferralSource', N'Prison Education Provider', N'Prison Education Provider', N'A referral source', N'2024-05-31 12:30:42.7615425', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (14, N'ReferralSource', N'DWP', N'DWP', N'A referral source', N'2024-05-31 12:30:42.7615421', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (15, N'ReferralSource', N'Healthcare', N'Healthcare', N'A referral source', N'2024-05-31 12:30:42.7615417', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (16, N'ReferralSource', N'Community / Voluntary Sector organisation', N'Community / Voluntary Sector organisation', N'A referral source', N'2024-05-31 12:30:42.7615414', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (17, N'ReferralSource', N'Local Authority', N'Local Authority', N'A referral source', N'2024-05-31 12:30:42.7615410', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (18, N'ReferralSource', N'Courts', N'Courts', N'A referral source', N'2024-05-31 12:30:42.7615390', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (19, N'ReferralSource', N'Self-referral', N'Self-referral', N'A referral source', N'2024-05-31 12:30:42.7615372', null, null, null); +INSERT INTO dbo.KeyValue (Id, Name, Value, Text, Description, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (20, N'ReferralSource', N'Other', N'Other', N'A referral source (please state)', N'2024-05-31 12:30:42.7615265', null, null, null); + +SET IDENTITY_INSERT KeyValue OFF; + +GO + +SET IDENTITY_INSERT Location ON; + +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (1, N'Risley', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888014', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (2, N'Lancaster', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888012', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (3, N'Forest Bank', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888009', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (4, N'Altcourse', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888007', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (5, N'Preston', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888004', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (6, N'Buckley Hall', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888001', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (7, N'Liverpool', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887998', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (8, N'Manchester', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887995', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (9, N'Thorn Cross', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887991', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (10, N'Haverigg', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887988', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (11, N'Hindley', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887984', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (12, N'Kirkham', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5887894', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (13, N'Wymott', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5886872', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (14, N'Styal', N'Evolution1', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888017', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (15, N'Holme House', N'Evolution2', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888025', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (16, N'Northumberland', N'Evolution2', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888028', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (17, N'Durham', N'Evolution2', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888030', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (18, N'Kirklevington Grange', N'Evolution2', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888032', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (19, N'Low Newton', N'Evolution2', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888034', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (20, N'Wealstun', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888037', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (21, N'Moorland', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888043', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (22, N'Humber', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888046', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (23, N'Doncaster', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888051', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (24, N'Leeds', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888053', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (25, N'Hull', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888055', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (26, N'Full Sutton', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888058', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (27, N'Hatfield', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888060', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (28, N'Lindholme', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888063', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (29, N'Askham Grange', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888066', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (30, N'New Hall', N'Evolution3', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888076', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (31, N'Featherstone', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888088', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (32, N'Drake Hall', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888091', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (33, N'Birmingham', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888093', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (34, N'Brinsford', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888096', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (35, N'Dovegate', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888101', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (36, N'Hewell', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888104', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (37, N'Oakwood', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888106', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (38, N'Stoke Heath', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888108', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (39, N'Swinfen Hall', N'Evolution4', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888111', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (40, N'Ranby', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888114', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (41, N'Nottingham', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888118', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (42, N'Five Wells', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888121', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (43, N'Lincoln', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888125', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (44, N'North Sea Camp', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888127', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (45, N'Onley', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888130', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (46, N'Stocken', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888132', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (47, N'Whatton', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888135', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (48, N'Foston Hall', N'Evolution5', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888138', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (49, N'The Mount', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888140', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (50, N'Peterborough (M)', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888143', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (51, N'Bedford', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888146', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (52, N'Chelmsford', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888149', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (53, N'Highpoint', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888151', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (54, N'Hollesley Bay', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888153', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (55, N'Littlehey', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888157', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (56, N'Norwich', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888159', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (57, N'Wayland', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888162', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (58, N'Peterborough (F)', N'Evolution6', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888165', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (59, N'High Down', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888167', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (60, N'Wandsworth', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888170', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (61, N'Thameside', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888171', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (62, N'Brixton', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888179', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (63, N'Feltham', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888181', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (64, N'Isis', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888184', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (65, N'Pentonville', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888186', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (66, N'Bronzefield', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888189', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (67, N'Downview', N'Evolution7', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888197', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (68, N'Portland', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888199', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (69, N'Exeter', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888201', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (70, N'Bristol', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888204', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (71, N'Channings Wood', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888206', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (72, N'Dartmoor', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888209', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (73, N'Leyhill', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888212', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (74, N'Guys Marsh', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888214', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (75, N'The Verne', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888217', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (76, N'Eastwood Park', N'Evolution8', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888219', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (77, N'Rochester', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 0, N'2024-05-31 12:30:39.5888221', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (78, N'Elmley', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888224', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (79, N'Lewes', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888227', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (80, N'Winchester', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 1, N'2024-05-31 12:30:39.5888229', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (81, N'Aylesbury', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888232', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (82, N'Bullingdon', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888234', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (83, N'Ford', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888237', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (84, N'Springhill', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888239', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (85, N'Stanford Hill', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888241', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (86, N'Swaleside', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888244', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (87, N'Woodhill', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 0, 2, N'2024-05-31 12:30:39.5888246', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (88, N'Send', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888253', null, null, null); +INSERT INTO dbo.Location (Id, Name, ContractId, LifetimeStart, LifetimeEnd, ParentLocationId, GenderProvisionId, LocationTypeId, Created, CreatedBy, LastModified, LastModifiedBy) VALUES (89, N'East Sutton Park', N'Evolution9', N'2024-05-01 00:00:00.0000000', N'2029-03-31 23:59:59.0000000', null, 1, 3, N'2024-05-31 12:30:39.5888312', null, null, null); + +SET IDENTITY_INSERT Location OFF; \ No newline at end of file diff --git a/db/seed/README.md b/db/seed/README.md new file mode 100644 index 00000000..f2273736 --- /dev/null +++ b/db/seed/README.md @@ -0,0 +1,8 @@ +# Database Seed Scripts + +This directory contains SQL scripts to seed the database with initial data. + +## How to Use + +1. Ensure your database is created and migrated using EF Core. +2. Run the seed scripts in the alphabetical order \ No newline at end of file diff --git a/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs b/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs index 169abf47..3411f55d 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs @@ -1,35 +1,7 @@ -using System.Text.Json; -using Cfo.Cats.Domain.Common.Enums; -using Cfo.Cats.Domain.Entities.Administration; -using Cfo.Cats.Domain.Identity; -using Cfo.Cats.Infrastructure.Constants.ClaimTypes; -using Cfo.Cats.Infrastructure.Constants.Role; -using Cfo.Cats.Infrastructure.PermissionSet; -using Cfo.Cats.Infrastructure.Persistence.Initializers; -using DocumentFormat.OpenXml.Office2010.Excel; +namespace Cfo.Cats.Infrastructure.Persistence; -namespace Cfo.Cats.Infrastructure.Persistence; - -public class ApplicationDbContextInitializer +public class ApplicationDbContextInitializer(ILogger logger, ApplicationDbContext context) { - private readonly ApplicationDbContext context; - private readonly ILogger logger; - private readonly RoleManager roleManager; - private readonly UserManager userManager; - - public ApplicationDbContextInitializer( - ILogger logger, - ApplicationDbContext context, - UserManager userManager, - RoleManager roleManager - ) - { - this.logger = logger; - this.context = context; - this.userManager = userManager; - this.roleManager = roleManager; - } - public async Task InitialiseAsync() { try @@ -48,117 +20,4 @@ public async Task InitialiseAsync() throw; } } - - public async Task SeedAsync() - { - try - { - await TrySeedAsync(); - context.ChangeTracker.Clear(); - } - catch (Exception ex) - { - logger.LogError(ex, "An error occurred while seeding the database"); - throw; - } - } - - private async Task TrySeedAsync() - { - await SeedTenants(); - await SeedContracts(); - await SeedLocations(); - await SeedDictionaries(); - - // Default roles - var administratorRole = new ApplicationRole(RoleName.Admin) { Description = "Admin Group" }; - var basicRole = new ApplicationRole(RoleName.Basic) { Description = "Basic User Group" }; - - var permissions = Permissions.GetRegisteredPermissions(); - - if (roleManager.Roles.All(r => r.Name != administratorRole.Name)) - { - await roleManager.CreateAsync(administratorRole); - - foreach (var permission in permissions) - { - await roleManager.AddClaimAsync( - administratorRole, - new Claim(ApplicationClaimTypes.Permission, permission) - ); - } - } - - if (roleManager.Roles.All(r => r.Name != basicRole.Name)) - { - await roleManager.CreateAsync(basicRole); - foreach (var permission in permissions.Where(p => p.EndsWith(".View"))) - { - await roleManager.AddClaimAsync(basicRole, new Claim(ApplicationClaimTypes.Permission, permission)); - } - } - - var defaultUser = new ApplicationUser() - { - UserName = "support.worker@justice.gov.uk", - Provider = "Local", - IsActive = true, - TenantId = context.Tenants.First().Id, - TenantName = context.Tenants.First().Name, - DisplayName = "Support Worker", - Email = "support.worker@justice.gov.uk", - EmailConfirmed = true, - ProfilePictureDataUrl = - "https://avatars.githubusercontent.com/u/9332472?s=400&u=73c208bf07ba967d5407aae9068580539cfc80a2&v=4", - TwoFactorEnabled = false - }; - - if (userManager.Users.All(u => u.UserName != "support.worker@justice.gov.uk")) - { - await userManager.CreateAsync(defaultUser, "Password123!"); - await userManager.AddToRolesAsync(defaultUser, new[] { administratorRole.Name! }); - } - } - private async Task SeedDictionaries() - { - if (await context.KeyValues.AnyAsync() == false) - { - var kvps = SeedingData.GetDictionaries(); - context.KeyValues.AddRange(kvps); - await context.SaveChangesAsync(); - } - } - - private async Task SeedLocations() - { - if (await context.Locations.AnyAsync() == false) - { - var locations = SeedingData.GetLocations(); - context.Locations.AddRange(locations); - await context.SaveChangesAsync(); - - } - } - - private async Task SeedTenants() - { - if (await context.Tenants.OrderBy(r => r.Id).Select(e => e.Id).FirstOrDefaultAsync() == null) - { - var tenants = SeedingData.GetTenants(); - context.Tenants.AddRange(tenants); - await context.SaveChangesAsync(); - } - } - - private async Task SeedContracts() - { - if (await context.Contracts.OrderBy(r => r.Id).Select(e => e.Id).FirstOrDefaultAsync() is null) - { - var contracts = SeedingData.GetContracts(); - context.Contracts.AddRange(contracts); - await context.SaveChangesAsync(); - } - } - - } diff --git a/src/Infrastructure/Persistence/DataSeeds/Development/Locations.json b/src/Infrastructure/Persistence/DataSeeds/Development/Locations.json deleted file mode 100644 index 0352ab07..00000000 --- a/src/Infrastructure/Persistence/DataSeeds/Development/Locations.json +++ /dev/null @@ -1,91 +0,0 @@ -[ - {"contractId": "Evolution1", "name": "Risley", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Lancaster", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Forest Bank", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Altcourse", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Preston", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Buckley Hall", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Liverpool", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Manchester", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Thorn Cross", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Haverigg", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Hindley", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Kirkham", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Wymott", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution1", "name": "Styal", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution2", "name": "Holme House", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution2", "name": "Northumberland", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution2", "name": "Durham", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution2", "name": "Kirklevington Grange", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution2", "name": "Low Newton", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution3", "name": "Wealstun", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Moorland", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Humber", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Doncaster", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Leeds", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Hull", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Full Sutton", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Hatfield", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Lindholme", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution3", "name": "Askham Grange", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution3", "name": "New Hall", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution4", "name": "Featherstone", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Drake Hall", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Birmingham", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Brinsford", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Dovegate", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Hewell", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Oakwood", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Stoke Heath", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution4", "name": "Swinfen Hall", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Ranby", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Nottingham", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Five Wells", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Lincoln", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "North Sea Camp", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Onley", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Stocken", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Whatton", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution5", "name": "Foston Hall", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution6", "name": "The Mount", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Peterborough (M)", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Bedford", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Chelmsford", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Highpoint", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Hollesley Bay", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Littlehey", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Norwich", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Wayland", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution6", "name": "Peterborough (F)", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution7", "name": "High Down", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Wandsworth", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Thameside", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Brixton", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Feltham", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Isis", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Pentonville", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution7", "name": "Bronzefield", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution7", "name": "Downview", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution8", "name": "Portland", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Exeter", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Bristol", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Channings Wood", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Dartmoor", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Leyhill", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Guys Marsh", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "The Verne", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution8", "name": "Eastwood Park", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution9", "name": "Rochester", "locationType": "Wing", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Elmley", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Lewes", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Winchester", "locationType": "Feeder", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Aylesbury", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Bullingdon", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Ford", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Springhill", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Stanford Hill", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Swaleside", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Woodhill", "locationType": "Outlying", "genderProvision": "Male"}, - {"contractId": "Evolution9", "name": "Send", "locationType": "Unspecified", "genderProvision": "Female"}, - {"contractId": "Evolution9", "name": "East Sutton Park", "locationType": "Unspecified", "genderProvision": "Female"} -] diff --git a/src/Infrastructure/Persistence/DataSeeds/Development/Users.json b/src/Infrastructure/Persistence/DataSeeds/Development/Users.json deleted file mode 100644 index 9a8454fb..00000000 --- a/src/Infrastructure/Persistence/DataSeeds/Development/Users.json +++ /dev/null @@ -1,30 +0,0 @@ - [ - { - "FirstName": "Internal", - "LastName": "Admin", - "Email": "Internal.Admin@creatingfutureopportunities.gov.uk", - "Roles": [ - "Internal", - "Administrator" - ], - "Password": "Pass@word1", - "TenantId": "1." - }, - { - "FirstName": "Internal", - "LastName": "User", - "Email": "Internal@creatingfutureopportunities.gov.uk", - "Roles": [ - "Internal" - ], - "Password": "Pass@word2", - "TenantId": "1." - }, - { - "FirstName": "Regular", - "LastName": "User", - "Email": "User@creatingfutureopportunities.gov.uk", - "Password": "Pass@word3", - "TenantId": "1." - } -] \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Initializers/SeedingData.cs b/src/Infrastructure/Persistence/Initializers/SeedingData.cs deleted file mode 100644 index 4cdb74af..00000000 --- a/src/Infrastructure/Persistence/Initializers/SeedingData.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System.Text.Json; -using Cfo.Cats.Application.Common.Exceptions; -using Cfo.Cats.Domain.Common.Enums; -using Cfo.Cats.Domain.Entities.Administration; -using Cfo.Cats.Domain.Identity; -using Polly; - -namespace Cfo.Cats.Infrastructure.Persistence.Initializers; - -public static class SeedingData -{ - - public static IEnumerable GetTenants() - { - yield return Tenant.Create("1.", "CFO", "Root tenant for Creating Future Opportunities"); - yield return Tenant.Create("1.1.", "CFO Evolution", "Top level tenant for Evolution Programme"); - yield return Tenant.Create("1.1.1.", "Alpha", "Alpha"); - yield return Tenant.Create("1.1.2.", "Bravo", "Top level tenant for provider Bravo"); - yield return Tenant.Create("1.1.2.1.", "Bravo (A)", "Bravo (A)"); - yield return Tenant.Create("1.1.2.2.", "Bravo (B)", "Bravo (B)"); - yield return Tenant.Create("1.1.2.3.", "Bravo (C)", "Bravo (C)"); - yield return Tenant.Create("1.1.3.", "Charlie", "Charlie"); - yield return Tenant.Create("1.1.4.", "Delta", "Top level tenant for Delta"); - yield return Tenant.Create("1.1.4.1.", "Delta (A)", "Delta (A)"); - yield return Tenant.Create("1.1.4.2.", "Delta (B)", "Delta (B)"); - yield return Tenant.Create("1.1.5.", "Echo", "Echo"); - yield return Tenant.Create("1.1.6.", "Foxtrot", "Foxtrot"); - } - - public static IEnumerable GetContracts() - { - yield return Contract.Create("Evolution1", 1, "North West", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution2", 2, "North East", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution3", 3, "Yorkshire and Humberside", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution4", 4, "West Midlands", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution5", 5, "East Midlands", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution6", 6, "East Of England", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution7", 7, "London", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution8", 8, "South West", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Contract.Create("Evolution9", 9, "South East", "1.", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - } - - public static IEnumerable GetLocations() - { - yield return Location.Create("Risley", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Lancaster", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Forest Bank", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Altcourse", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Preston", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Buckley Hall", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Liverpool", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Manchester", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Thorn Cross", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Haverigg", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Hindley", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Kirkham", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Wymott", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Styal", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution1", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Holme House", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution2", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Northumberland", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution2", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Durham", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution2", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Kirklevington Grange", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution2", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Low Newton", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution2", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Wealstun", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Moorland", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Humber", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Doncaster", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Leeds", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Hull", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Full Sutton", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Hatfield", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Lindholme", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Askham Grange", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("New Hall", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution3", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Featherstone", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Drake Hall", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Birmingham", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Brinsford", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Dovegate", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Hewell", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Oakwood", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Stoke Heath", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Swinfen Hall", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution4", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Ranby", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Nottingham", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Five Wells", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Lincoln", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("North Sea Camp", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Onley", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Stocken", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Whatton", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Foston Hall", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution5", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("The Mount", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Peterborough (M)", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Bedford", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Chelmsford", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Highpoint", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Hollesley Bay", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Littlehey", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Norwich", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Wayland", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Peterborough (F)", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution6", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("High Down", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Wandsworth", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Thameside", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Brixton", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Feltham", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Isis", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Pentonville", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Bronzefield", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Downview", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution7", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Portland", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Exeter", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Bristol", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Channings Wood", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Dartmoor", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Leyhill", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Guys Marsh", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("The Verne", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Eastwood Park", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution8", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Rochester", GenderProvision.FromName("Male"), LocationType.FromName("Wing"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Elmley", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Lewes", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Winchester", GenderProvision.FromName("Male"), LocationType.FromName("Feeder"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Aylesbury", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Bullingdon", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Ford", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Springhill", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Stanford Hill", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Swaleside", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Woodhill", GenderProvision.FromName("Male"), LocationType.FromName("Outlying"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("Send", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - yield return Location.Create("East Sutton Park", GenderProvision.FromName("Female"), LocationType.FromName("Unspecified"), "Evolution9", new DateTime(2024, 5, 1), new DateTime(2029, 03, 31, 23, 59, 59)); - } - - public static IEnumerable GetDictionaries() - { - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CFO Evolution Provider", Text = "CFO Evolution Provider", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Probation", Text = "Probation", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Approved Premises", Text = "Approved Premises", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CAS2", Text = "CAS2", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CAS3", Text = "CAS3", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Custodial Family Services", Text = "Custodial Family Services", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CRS - Women", Text = "CRS- Women", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CRS - Personal Wellbeing", Text = "CRS- Personal Wellbeing", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CRS - Dependency & Recovery", Text = "CRS- Dependency & Recovery", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "CRS - Accommodation", Text = "CRS- Accommodation", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Custody staff", Text = "Custody staff", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "New Futures Network", Text = "New Futures Network", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Prison Education Provider", Text = "Prison Education Provider", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "DWP", Text = "DWP", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Healthcare", Text = "Healthcare", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Community / Voluntary Sector organisation", Text = "Community / Voluntary Sector organisation", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Local Authority", Text = "Local Authority", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Courts", Text = "Courts", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Self-referral", Text = "Self-referral", Description = "A referral source" }; - yield return new KeyValue { Name = Picklist.ReferralSource, Value = "Other", Text = "Other", Description = "A referral source (please state)" }; - - } - -} \ No newline at end of file diff --git a/src/Server.UI/Program.cs b/src/Server.UI/Program.cs index 3de44722..862f7db7 100644 --- a/src/Server.UI/Program.cs +++ b/src/Server.UI/Program.cs @@ -25,7 +25,6 @@ using var scope = app.Services.CreateScope(); var initializer = scope.ServiceProvider.GetRequiredService(); await initializer.InitialiseAsync(); - await initializer.SeedAsync(); } await app.RunAsync();