I faced with an issue, where I can't reach the SQL script to apply the migration. Here is my migration code:
public partial class AddSomethingMigration : Migration
{
private const string MIGRATION_SQL_SCRIPT_FILE_NAME = @"Migrations\Scripts\20170710123314_AddSomethingMigration.sql";
protected override void Up(MigrationBuilder migrationBuilder)
{
string sql = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, MIGRATION_SQL_SCRIPT_FILE_NAME));
migrationBuilder.Sql(File.ReadAllText(sql));
}
}
So when I use the Package Manager Console on the local machine all works fine. But when I deploy to the environment I get the discrepancy to the file.
Can I run my static SQL scripts via EF migration automatically at all, or I should paste the SQL query inline in code?



