diff --git a/API/FamilyTreeAPI/Program.cs b/API/FamilyTreeAPI/Program.cs index 8ca30e6..0e36ec0 100644 --- a/API/FamilyTreeAPI/Program.cs +++ b/API/FamilyTreeAPI/Program.cs @@ -123,7 +123,16 @@ using (var scope = app.Services.CreateScope()) //if (!databaseCreator.Exists()) try { - databaseCreator.CreateTables(); + // Check if database exists + if (!databaseCreator.Exists()) + { + databaseCreator.Create(); + } + + if (!databaseCreator.HasTables()) + { + databaseCreator.CreateTables(); + } } catch { diff --git a/API/FamilyTreeAPI/appsettings.json b/API/FamilyTreeAPI/appsettings.json index e599f51..870e5c1 100644 --- a/API/FamilyTreeAPI/appsettings.json +++ b/API/FamilyTreeAPI/appsettings.json @@ -3,7 +3,7 @@ "AppSettings": { "Secret": "Super Secret SIGN AND VERIFY JWT TOKENS, BEARER TOKEN USE WHEN CALLING THIS API.", "SQLConnectionString_i": "host=localhost;port=5432;database=FamilyTreeDB_prod;username=postgres;password=Positive~1;", - "SQLConnectionString": "host=192.168.1.240;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;", + "SQLConnectionString": "host=192.168.1.240;port=5432;database=FamilyTreeDB_prod;username=postgres;password=Positive~1;", "ImageFolder": "c:\\temp\\Family", "ImportFolder": "c:\\temp"