How can I hook onto my app getting installed or updated?
I want some functions to be run everytime my app is getting installed or updated like learning database values, updating app schema via bench update so new schema can be stored against database and running patches like adding some data or removing some data.
you can hook into various events related to your app, including its installation or updates. This is primarily done through the hooks.py file in your Frappe application.
you can use hooks like after_install , before_install , before_migrate , and after_migrate .
Example:
# In hooks.py
# Define your custom functions
def after_install_operations():
# Code to run after installation
pass
def before_migrate_operations():
# Code to run before migration (update)
pass
# Set up hooks
after_install = "appname.path.to.function.after_install_operations"
before_migrate = "appname.path.to.function.before_migrate_operations"
How can I ask for my custom_information when frappe is getting setup for the first time. Like after first login, we ask company name, chart of accounts etc… , how can I ask details regarding my custom_app too on that point?