Skip to content

Commit 26e3120

Browse files
committed
Fix dev vs deployed migrations.
1 parent 159e034 commit 26e3120

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

MyApp/Migrations/Migration1002.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,11 @@ public class JobApplicationAttachment
217217

218218
public override void Up()
219219
{
220-
var profilesDir = Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "../../../wwwroot", "profiles"));
221-
var sourceDir = Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "../../../Migrations/seed"));
222-
var targetDir = Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "../../../App_Data"));
220+
221+
var profilesDir = HostContext.AppHost.IsDevelopmentEnvironment() ? "./wwwroot/profiles" :
222+
Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "./wwwroot", "profiles"));
223+
var sourceDir = Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "./Migrations/seed"));
224+
var targetDir = Path.GetFullPath(Path.Join(AppContext.BaseDirectory, "./App_Data"));
223225

224226
Db.CreateTable<Contact>();
225227
Db.CreateTable<Job>();

0 commit comments

Comments
 (0)