Where is the code that insert the data source information to grafana.db?

I’m developing grafana that can use MySQL as data source with TLS for studying.
I cloud connect to MySQL with TLS that modify grafana.db table(data_source) directly.

Next I want to setup it on Web GUI.
But I can’t find where grafana insert data source information in grafana.db.