Initial ABSDEV deployment framework development preview
ABSDEV Framework CI / framework-validation (push) Canceled after 0s

This commit is contained in:
2026-11-26 11:35:28 +00:00
commit d6e2317016
76 changed files with 20260 additions and 0 deletions
+92
View File
@@ -0,0 +1,92 @@
"""MySQL database command construction."""
from core.database import DatabaseAdapter
class MySQLAdapter(DatabaseAdapter):
backup_extension = ".sql"
client_configuration = (
"--defaults-file=/run/secrets/absdev-client.cnf"
)
def connection_arguments(self):
return [
"--protocol=TCP",
f"--host={self.database['host']}",
f"--port={self.database['port']}",
f"--user={self.database['username']}",
]
def query_command(self, query):
return (
self.docker_exec()
+ [
"mysql",
self.client_configuration,
]
+ self.connection_arguments()
+ [
"--batch",
"--skip-column-names",
f"--database={self.database['name']}",
"--execute",
query,
]
)
def ping_command(self):
return self.query_command("SELECT 1")
def version_command(self):
return self.query_command("SELECT VERSION()")
def identity_command(self):
return self.query_command(
"SELECT DATABASE(), CURRENT_USER(), @@server_uuid"
)
def backup_command(self):
return (
self.docker_exec()
+ [
"mysqldump",
self.client_configuration,
]
+ self.connection_arguments()
+ [
"--single-transaction",
"--quick",
"--no-tablespaces",
"--skip-lock-tables",
"--set-gtid-purged=OFF",
"--hex-blob",
"--triggers",
"--routines",
"--events",
self.database["name"],
]
)
def restore_command(self, target):
target = self.validate_restore_target(target)
return (
self.docker_exec(interactive=True)
+ [
"mysql",
self.client_configuration,
]
+ self.connection_arguments()
+ [
f"--database={target}",
]
)