case 4221

This commit is contained in:
2022-10-26 18:35:44 +00:00
parent 2f26d8c8c1
commit 50c969b4ce
3 changed files with 19 additions and 10 deletions

4
.vscode/launch.json vendored
View File

@@ -53,6 +53,7 @@
// }, // },
"env": { "env": {
//############ PERPETUAL BLOCK ######################
// "ASPNETCORE_ENVIRONMENT": "Development", // "ASPNETCORE_ENVIRONMENT": "Development",
"AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret", "AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret",
"AYANOVA_LOG_LEVEL": "Info", "AYANOVA_LOG_LEVEL": "Info",
@@ -106,6 +107,7 @@
}, },
"env": { "env": {
//############ SUBSCRIPTION MODE BLOCK ######################
// "ASPNETCORE_ENVIRONMENT": "Development", // "ASPNETCORE_ENVIRONMENT": "Development",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1", //"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
"AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret", "AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret",
@@ -117,7 +119,7 @@
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata", "AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
//"AYANOVA_REMOVE_LICENSE_FROM_DB":"true", // "AYANOVA_REMOVE_LICENSE_FROM_DB":"true",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
}, },
"sourceFileMap": { "sourceFileMap": {

View File

@@ -14,7 +14,7 @@ todo: Money money money...MONEY
- Can do todo-reorg and move to cases while awaiting responses for the above - Can do todo-reorg and move to cases while awaiting responses for the above
todo: case 4221 eval erase issue
todo: add guided tours case 4212 todo: add guided tours case 4212
todo: postgres 15 case 4214 todo: postgres 15 case 4214

View File

@@ -397,7 +397,14 @@ namespace AyaNova.Util
// and by v8 migrate and by license controller when erasing db // and by v8 migrate and by license controller when erasing db
internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep, bool isMigrate = false) internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep, bool isMigrate = false)
{ {
//case 4221
//erase plan to use truncate table instead of slower delete method
//- truncate table cascade deletes which removes all user accounts including superuser
//- duplicate the auser and auseroption tables to a temporary table to preserve them
//- do the full truncate
//- select the superuser account back to the auser and useroptions
//- discover where else this needs to be done
//- $profit
bool forSeeding = jobIdToKeep != Guid.Empty; bool forSeeding = jobIdToKeep != Guid.Empty;
_log.LogInformation("Erasing Database \"{0}\"", _dbName); _log.LogInformation("Erasing Database \"{0}\"", _dbName);
@@ -686,16 +693,16 @@ namespace AyaNova.Util
cmd.Connection = conn; cmd.Connection = conn;
//Boo! Can't do this becuase it will fail if there is a foreign key which nearly all tables have unless cascade option is used //Boo! Can't do this becuase it will fail if there is a foreign key which nearly all tables have unless cascade option is used
//but then cascade causes things to delete in any referenced table //but then cascade causes things to delete in any referenced table
// cmd.CommandText = "TRUNCATE \"" + sTable + "\" RESTART IDENTITY;"; cmd.CommandText = "TRUNCATE \"" + sTable + "\" RESTART IDENTITY CASCADE;";
cmd.CommandText = $"delete from {sTable};"; //// cmd.CommandText = $"delete from {sTable};";
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
if (!tableHasNoSequence) // // if (!tableHasNoSequence)
{ // // {
cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;"; // // cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;";
await cmd.ExecuteNonQueryAsync(); // // await cmd.ExecuteNonQueryAsync();
} // // }
} }
} }