It's not the best practice (as today), the best practice is to create a migration file
https://www.odoo.com/documentation/18.0/developer/reference/upgrades/upgrade_scripts.html