Error is occurring when i run my create+seed database script.
Cannot insert duplicate key row in object 'dbo.ResourceCategories' with unique index 'IX_UniqueResCatName'. The duplicate key value is (DSC20, DST20).
It happens on the first row I attempt to seed, but the Database has definitely been dropped and destroyed.
My ResouceCategory.cs
file is setup to have a 2 element unique index, as discussed here
[MinLength(1), MaxLength(5)]
[Index("IX_UniqueResCatName", 1, IsUnique = true)]
public string Name { get; set; }
[MaxLength(50)]
[Index("IX_UniqueResCatName", 2, IsUnique = true)]
public string Description { get; set; }
I've auto-generated the Migrations for this this (which runs before seeding), and the relevant portion looks like
CREATE UNIQUE INDEX [IX_UniqueResCatName]
ON [dbo].[ResourceCategories] ([Name], [Description])
And an excerpt from the seeding SQL (ran automatically from a bash script):
INSERT INTO [dbo].[ResourceCategories] ([Id], [Description], [Name], [IsActive], [CreatedByUser], [CreatedOn], [LastUpdatedByUser], [LastUpdatedOn])
VALUES (NEWID(), 'DST20', 'DSC20', 1, 'system', GETDATE(), 'system', GETDATE())
INSERT INTO [dbo].[ResourceCategories] ([Id], [Description], [Name], [IsActive],[CreatedByUser], [CreatedOn], [LastUpdatedByUser], [LastUpdatedOn])
VALUES (NEWID(), 'EPT10', 'EPC10', 1, 'system', GETDATE(), 'system', GETDATE())
INSERT INTO [dbo].[ResourceCategories] ([Id], [Description], [Name], [IsActive],[CreatedByUser], [CreatedOn], [LastUpdatedByUser], [LastUpdatedOn])
VALUES (NEWID(), 'EPT10', 'EPC11', 1, 'system', GETDATE(), 'system', GETDATE())
INSERT INTO [dbo].[ResourceCategories] ([Id], [Description], [Name], [IsActive], [CreatedByUser], [CreatedOn], [LastUpdatedByUser], [LastUpdatedOn])
VALUES (NEWID(), 'EPT10', 'EPC12', 1, 'system', GETDATE(), 'system', GETDATE())