WIP: backup fix
This commit is contained in:
@@ -41,6 +41,7 @@ public class AdminController : Controller
|
|||||||
const string formatMediaName = $"DatabaseToolkitBackup_{databaseName}";
|
const string formatMediaName = $"DatabaseToolkitBackup_{databaseName}";
|
||||||
const string formatName = $"Full Backup of {databaseName}";
|
const string formatName = $"Full Backup of {databaseName}";
|
||||||
|
|
||||||
|
/*
|
||||||
var connection = new SqlConnection(_configuration.GetConnectionString("SQLDatabase"));
|
var connection = new SqlConnection(_configuration.GetConnectionString("SQLDatabase"));
|
||||||
|
|
||||||
const string sql = """
|
const string sql = """
|
||||||
@@ -62,15 +63,15 @@ public class AdminController : Controller
|
|||||||
command.Parameters.AddWithValue("@formatName", formatName);
|
command.Parameters.AddWithValue("@formatName", formatName);
|
||||||
|
|
||||||
command.ExecuteNonQuery();
|
command.ExecuteNonQuery();
|
||||||
|
*/
|
||||||
var body = new Google.Apis.Drive.v3.Data.File
|
var body = new Google.Apis.Drive.v3.Data.File
|
||||||
{
|
{
|
||||||
Name = Path.GetFileName(localDatabasePath),
|
Name = Path.GetFileName(localDatabasePath),
|
||||||
Parents = new List<string?> { _configuration["GDriveBackupDirectory"] },
|
Parents = new List<string?> { "1ANm0pokPFgBw7vIaxLgDWXqznl3UjVvJ" },
|
||||||
MimeType = "application/octet-stream"
|
MimeType = "application/octet-stream"
|
||||||
};
|
};
|
||||||
|
|
||||||
var fsSource = new FileStream(localDatabasePath, FileMode.Open, FileAccess.Read);
|
var fsSource = new FileStream("/Users/mz/Projects/Diuna/diunabi-morska-9.bak", FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
if (_googleDriveHelper.Service is null)
|
if (_googleDriveHelper.Service is null)
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ public class AdminController : Controller
|
|||||||
|
|
||||||
var request = _googleDriveHelper.Service.Files.Create(body, fsSource, body.MimeType);
|
var request = _googleDriveHelper.Service.Files.Create(body, fsSource, body.MimeType);
|
||||||
request.Fields = "id";
|
request.Fields = "id";
|
||||||
|
|
||||||
request.Upload();
|
request.Upload();
|
||||||
|
|
||||||
_logsController.AddEntry(new LogEntry
|
_logsController.AddEntry(new LogEntry
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"appLogsFile": "13PuDvS3_HAYoSLOCgKexzlzIDLUilkApUF8QiJMTae0",
|
"appLogsFile": "13PuDvS3_HAYoSLOCgKexzlzIDLUilkApUF8QiJMTae0",
|
||||||
"apiLocalUrl": "localhost:5400",
|
"apiLocalUrl": "localhost:5400",
|
||||||
"dbBackupFile": "/home/mz/backups/diunabi-morska",
|
"dbBackupFile": "/home/mz/backups/diunabi-morska",
|
||||||
"GDriveBackupDirectory": "1FEcdtVcF2cuqCROdq-vlBNs__th1M8_P",
|
"GDriveBackupDirectory": "1ANm0pokPFgBw7vIaxLgDWXqznl3UjVvJ",
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
|
|||||||
Reference in New Issue
Block a user