case 4221
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -53,6 +53,7 @@
|
||||
// },
|
||||
|
||||
"env": {
|
||||
//############ PERPETUAL BLOCK ######################
|
||||
// "ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret",
|
||||
"AYANOVA_LOG_LEVEL": "Info",
|
||||
@@ -106,6 +107,7 @@
|
||||
},
|
||||
|
||||
"env": {
|
||||
//############ SUBSCRIPTION MODE BLOCK ######################
|
||||
// "ASPNETCORE_ENVIRONMENT": "Development",
|
||||
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
|
||||
"AYANOVA_JWT_SECRET": "1111111MyRandom32CharacterSecret",
|
||||
@@ -117,7 +119,7 @@
|
||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||
//"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"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
|
||||
@@ -14,7 +14,7 @@ todo: Money money money...MONEY
|
||||
- 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: postgres 15 case 4214
|
||||
|
||||
|
||||
@@ -397,7 +397,14 @@ namespace AyaNova.Util
|
||||
// and by v8 migrate and by license controller when erasing db
|
||||
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;
|
||||
|
||||
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
|
||||
@@ -686,16 +693,16 @@ namespace AyaNova.Util
|
||||
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
|
||||
//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};";
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
if (!tableHasNoSequence)
|
||||
{
|
||||
cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;";
|
||||
//// cmd.CommandText = $"delete from {sTable};";
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
// // if (!tableHasNoSequence)
|
||||
// // {
|
||||
// // cmd.CommandText = $"ALTER SEQUENCE {sTable}_id_seq RESTART WITH 1;";
|
||||
// // await cmd.ExecuteNonQueryAsync();
|
||||
|
||||
}
|
||||
// // }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user