Is it possible to make database changes using postgres rather than rake?

I’m just getting started learning ruby, but I’ve been a DBA for over 30 years, the last 20 of them on PostgreSQL.

The data structure is complex, but I’ve seen (and probably written) worse.

Is it possible to do things like change what group a large number of users are in using SQL rather than rake? What are the gotcha’s?

1 Like

You are kind of playing with fire if you go down that path, you are likely to miss records in all sorts of auditing tables and clearly bypass lots of validations in code.

It is technically possible buy highly risky.


See also Administrative Bulk Operations for ways to do bulk updates.


Yeah and I’m not going the SQL route. Sometimes when you are faced with a problem, a more creative approach to the problem is more elegant than your original design, and that’s how I’m structuring my archives.

But I am impressed with the data structure Discourse is using, and my congratulations to the data design team.