I have created an SQL script file with a bunch of insert’s into a table if the values do not already exist.
It’s made up with a series of:
<code>INSERT INTO Departments (Number, [Name])
SELECT 3, 'TOPS'
WHERE NOT EXISTS (SELECT Number FROM Departments
WHERE Number = 3)
GO
</code>
<code>INSERT INTO Departments (Number, [Name])
SELECT 3, 'TOPS'
WHERE NOT EXISTS (SELECT Number FROM Departments
WHERE Number = 3)
GO
</code>
INSERT INTO Departments (Number, [Name])
SELECT 3, 'TOPS'
WHERE NOT EXISTS (SELECT Number FROM Departments
WHERE Number = 3)
GO
I have been asked if I can create a migration script in Visual Studio Entity Framework so that other dev’s can run it using EF Code First and calling the update-database command.
I’ve no idea how to create a migration script to run this. Any pointers appreciated.