T S Vallender

databases

Discovered today that even if you explicitly supply a username/password to psql, by default it will completely ignore them if you’re connecting over a socket, rather than the network. That was painful.
Tags:

Spent time today upgrading the operating system on some VMs running databases. Learned a bunch dumping and restoring data, setting up replicas etc. Found out the hard way that Cloud66 don't automatically update the environment variables to reflect these changes until you redeploy. Some trial by fire learning followed.
Tags:

Wrote a Rake task to update some database columns then immediately rewrote it in SQL directly. First time working with jsonb in SQL: I like it.
Tags:

I’ve started reading through SQL for Mere Mortals, and have set up the supplied databases to follow along with the examples.
Tags:

Wrote a little SQL task to convert various tables to a JSON column using rows_to_json, the sheer speed of the thing was incredibly satisfying.
Tags:

Was curious if Rails supports database-generated columns: turns out, yes, as of Rails 7:

create_table :users do |t|
  t.numeric :height_cm
  t.virtual :height_in, type: :numeric, as: 'height_cm / 2.54', stored: true
end
Tags: