I have created a 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)
</code>
<code>INSERT INTO Departments (Number, [Name])
SELECT 3, 'TOPS'
WHERE NOT EXISTS (SELECT Number FROM Departments
WHERE Number = 3)
</code>
INSERT INTO Departments (Number, [Name])
SELECT 3, 'TOPS'
WHERE NOT EXISTS (SELECT Number FROM Departments
WHERE Number = 3)
I have been asked if I can create a migration script in Visual Studio Entity Framework so that other devs can run it using EF code-first and calling the update-database
command.
I have no idea how to create a migration script to run this. Any pointers appreciated.
2