It’s a bit tricky. Having a new site already created based on v12 and then restoring a backup of a previous version - because the patches may run into error (example :- renaming Production Order to Work Order patch because your site will already have a Work Order table, etc).
Method 1:
- switch your apps branch to a v10.x.x branch.
- Run
bench --site site_name reinstall --yes - Run
bench --site site_name --force restore path_to_backup_file - Now, switch the apps branch back to v12 branch
- And run
bench --site site_name migrate
Method 2
- Run
bench --site site_name mariadb - Note down the database name in square brackets and then exit the mariadb console

- In terminal run
mysql -u root -p --max_allowed_packet=1073741824 db_name < path_to_sql_file - Run
bench --site site_name migrate
This should most probably work out without a hitch. You might wanna test it out though to avoid unintended encounters.