Question for Brent or Anish,
In authoring this PR, I changed the signature of the msar.search_records_from_table
DB function by adding an argument.
A failing test told me that I needed to add the new function signature to the all_mathesar_objects
table. This was new to me.
One upon a time, I had written some code to drop all msar functions. I see that we're no longer doing that. And I can see how we're using the all_mathesar_objects
to figure out what to drop.
Okay, fine. I added the new function signature to the table. The test passed. All seemed well.
But then I switched back to another branch, absent-mindedly not realizing that my DB code was now out of sync with my service layer code.
When I realized I needed to sync my DB code up again, I tried doing it from the UI via our "Reinstall Mathesar Schemas" feature. Previously (when we were dropping all msar functions) this feature worked under this scenario. But now, it didn't work. I should have copied the error messaged, but I was in a hurry, so I didn't. But it took me a while to resolve. I tried restarting Docker. That didn't work. I tried dropping the msar schema manually (thinking I'd be able to coax Mathesar into re-installing it, should it be missing entirely). Nope. That only caused more pain. It turned out that Mathesar didn't even let me remove the database connection because it couldn't connect to it (perhaps an unrelated bug?). In the end I just wipe out my docker state. I probably burned 45 minutes in all.
So my question is: what should I have done? When my DB state is out of sync with my service layer state and I want to go backwards in the chain of development (because I switched branches), what's the quickest and easiest way to get things synced up?
The trick is, when no credentials are submitted, we determine the credentials to use based on whichever ones own the schemata on the database. When the schemata are missing, there are no such credentials. So, we need to ask the user to provide them.