Restore user and its personal configurations

Hi all,
Due to issue https://github.com/metabase/metabase/issues/13739 and https://github.com/metabase/metabase/issues/13739 and the recommendation from @flamber downgrade again from (see post: Dashboard filters not showing all values) we downgraded again our Metabase instance to 0.36.7 until the problems are solved.

Error description:
Here an example of a problem we have due to a wrong deletion of a user: User is setup with firstname.lastname@domain.com (LDAP Authentication). As soon as he logged in a new user has been created with Firstname.Lastname@domain.com . I wanted to delete the newly created user Firstname.Lastname@domain.com and rename the existing user firstname.lastname@domain.com to Firstname.Lastname@domain.com in order that he doesn’t lose any information.

I accidentally deleted the existing user firstname.lastname@domain.com from the table core_user instead of the newly created user Firstname.Lastname@domain.com. Now its personal configurations are all lost :frowning. We do have also some problems with the dashboards he created with his “old” users.
Therefore my question: As soon as I delete a user from core_user, will there also deleted all personal configuations etc. (maybe with a delete cascade) from all other tables? Because I can’t find the old configuration of the user in table: collection

Thanks in advance for your feedback:

{
“browser-info”: {
“language”: “en”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“file.encoding”: “UTF-8”,
“java.runtime.name”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.7+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “https://adoptopenjdk.net/”,
“java.version”: “11.0.7”,
“java.vm.name”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.7+10”,
“os.name”: “Linux”,
“os.version”: “4.14.35-1902.302.2.el7uek.x86_64”,
“user.language”: “en”,
“user.timezone”: “GMT”
},
“metabase-info”: {
“databases”: [
“oracle”,
“firebird”,
“mysql”,
“postgres”,
“presto”,
“h2”
],
“hosting-env”: “unknown”,
“application-database”: “postgres”,
“application-database-details”: {
“database”: {
“name”: “PostgreSQL”,
“version”: “11.9”
},
“jdbc-driver”: {
“name”: “PostgreSQL JDBC Driver”,
“version”: “42.2.8”
}
},
“run-mode”: “prod”,
“version”: {
“date”: “2020-10-09”,
“tag”: “v0.36.7”,
“branch”: “release-0.36.x-with-new-build-scripts”,
“hash”: “ec751f0”
},
“settings”: {
“report-timezone”: “UTC”
}
}
}

@lst That’s two very different issues. With one of them, you can just downgrade, but with the LDAP, then you cannot downgrade, since the migration script has actually changed data, so you would need to revert to your backup.
And manually messing with the application database can easily cause more problems than you’re trying to solve. Yes, deleting users will also delete dependencies.
Revert to your backup.

Hi @flamber: Thanks a lot for your fast feedback. I will restore the tables from the backup for that user only.
Can you let me know which tables are involved, as we can’t do a complete restore of the database, as other applications are using the same postgres database as metabase.
From what I understood the following tables are involved:

  • core_user
  • collection

FYI: User used to write the queries in SQL (in Metabase) and saved it.

@lst I would recommend that you restore to a different database, then remove anything that involves non-Metabase related tables, and then configure Metabase to use that database instead.

Mixing multiple apps in a single database will likely cause you more problems in the future.

I haven’t checked structure, but if it automatically removed the collection, then it might have removed other information too from other tables.