Skip to content

MySQL foreign key constraints #343

@fbarmentlo

Description

@fbarmentlo

Question: Which MySQL versions are compatible for use as back-end? I experience problems with MariaDB 10.3 and 10.7:

Actual Result / Problem

Long story short: rebuilding my kubernetes cluster due to changes in underlying host. Got all pods running but import of backup fails with a MySQL error:
error: Error 1451: Cannot delete or update a parent row: a foreign key constraint fails (sshportal,host_group_acls, CONSTRAINT fk_host_group_acls_acl FOREIGN KEY (acl_id) REFERENCES acls (id))

I get similar errors when adding hosts or assigining hosts to groups via sshportal's admin commands.
already tried dumping the DB, modifying the dump and then importing it.. but i get similar errors.

Another one:
config> host create --name --group 2 ssh://@
error: Error 1452: Cannot add or update a child row: a foreign key constraint fails (sshportal.hosts, CONSTRAINT fk_hosts_hop FOREIGN KEY (hop_id) REFERENCES hosts (id))

Expected Result / Suggestion

It has worked before, but I accidentally used the "latest"-tag and my old environment is unavailable to check what version I was running.
I of course do not expected to see SQL-errors when adding hosts.

Some context

Using image docker.io/moul/sshportal:latest, but also tried versions 1.19.3, 1.19.0.

version: n/a
debug mode (server): false
Hostname: sshportal-7cf9d56bd4-dq7j5 (Kubernetes Pod)
CPUs: 4
Demo mode: false
DB Driver: mysql
DB Conn: root:@tcp(sshsql:3306)/sshportal?charset=utf8&parseTime=true&loc=Local
Bind Address: :2222
System Time: 2022-04-06T09:06:26.302297884Z
OS Type: linux
OS Architecture: amd64
Go routines: 10
Go version (build): go1.18
Uptime: 15h32m50.066400161s
User ID: 1
User email: admin@localhost
Version: n/a
GIT SHA: n/a
GIT Tag: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions