Environment
- M1 Pro MacBook Pro
- nanomdm v0.8.0
$ mysql --version
mysql Ver 9.4.0 for macos15.4 on arm64 (Homebrew)
Error
When trying to import the mysql schema into my mysql db. I receive the following error:
$ mysql -u root nanomdm < schema.sql
ERROR 6125 (HY000) at line 79: Failed to add the foreign key constraint. Missing unique key for constraint 'enrollments_ibfk_2' in the referenced table 'users'
Possible fix
In the mysql schema.sql file, on line 64 add UNIQUE(id),
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|
|
|
PRIMARY KEY (id, device_id), |
|
|
|
FOREIGN KEY (device_id) |
|
REFERENCES devices (id) |
|
ON DELETE CASCADE ON UPDATE CASCADE, |
After changing that line and removing the artifacts left in the DB after a partially ran sql script, it seems to build the DB fine and work.
Let me know what you think!
Environment
Error
When trying to import the mysql schema into my mysql db. I receive the following error:
Possible fix
In the mysql schema.sql file, on line 64 add
UNIQUE(id),nanomdm/storage/mysql/schema.sql
Lines 60 to 67 in 93afb5d
After changing that line and removing the artifacts left in the DB after a partially ran sql script, it seems to build the DB fine and work.
Let me know what you think!