Migration scripts not found when using Azure App Service
See original GitHub issueConfiguration: C# .Net 4.6.2 Azure SQL Server V12 Azure App Service
Migration Launcher:
try
{
string connectionString = Settings.GetSettings().DatabaseConnectionString;
SqlConnection cnx = new SqlConnection(connectionString);
Evolve.Evolve evolve = new Evolve.Evolve(cnx, msg => Trace.TraceInformation(msg))
{
Driver = "SqlClient", //Connect to SQL Server
Locations = new List<string> { "db/migrations" },
IsEraseDisabled = true, //Do not allow Erasing of schema
EnableClusterMode = true //Ensure that no other instances also attempt to migrate the database as the same time
};
evolve.Migrate();
}
catch (Exception ex)
{
Trace.TraceError("Database migration failed.", ex);
throw;
}
}
SQL files have been written and are uploaded to the web server:
During start the following logs are provided
Application: 2018-08-30T14:46:57 PID[5928] Information Executing Migrate...
Application: 2018-08-30T14:46:57 PID[5928] Information Evolve initialized.
Application: 2018-08-30T14:46:57 PID[5928] Information No metadata found.
Application: 2018-08-30T14:46:57 PID[5928] Information Database is up to date. No migration needed.
And a single blank changelog table has been created:
As far as I can tell I’ve followed all the requirements for using Evolve but I’m unsure of how to troubleshoot this issue further, any assistance would be greatly appreciated.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Troubleshoot web apps migration issues - Azure
Error code Error message Trou...
IISWebAppMigrationError Error occurred during app content copy operation. Chec...
ResultFileContentJSONParseError Results in unexpected format. Cont...
Read more >Applying migration script not working, no files to deploy
The pipeline is executed in the cloud, not running on my machine. I have tried setting the pipeline variable system.debug to true and...
Read more >Laravel Deployment on App Service Linux -
This post provides information for creating, configuring, and deploying a Laravel application on App Service Linux.
Read more >Migrating a Local Node Script to Azure Functions using VS ...
1. Install the Azure Functions Extension for VS Code · 2. Merge the Local Script Code into the Azure Function · 3. Create...
Read more >Applying migration script not working, no files to deploy
Coding example for the question Applying migration script not working, no files ... How do I run a PowerShell script on an Azure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for all your assistance, after a few experiments I discovered that the working directory on an Azure App Service is fixed to D:\Windows\System32. thus all uses of DirectoryInfo where branching off of there. using …/db/migrations" didn’t help either as this returned to the root of the D drive. To fix I added the following code:
This maps to the correct root folder which can then be changed to the correct relative folder.
To assist with future debugging may I suggest a branch from here: https://github.com/lecaillon/Evolve/blob/25dab78a7dd969ef4316063aa43b2fa1ed990329/src/Evolve/Migration/FileMigrationLoader.cs#L29 which would write a message if it was unable to locate the directory (ideally with the offending path)?
Nice, i did not know. I will think about a way of logging locations that do not exist.
Can I change your title issue to something like: “Scripts not found in Azure App Service” ?