######octothorp.es

#ruby-on-rails

  • Rails Migrations with Slony?

    https://justatheory.com/2007/03/rails-and-slony

    The new app I’m developing is written in Ruby on Rails and runs on PostgreSQL. We’re replicating our production database using Slony-I, but we’ve run into a bit of a snag: database schema updates must be run as plain SQL through a Slony script in order to ensure proper replication of the schema changes within a transaction, but Rails migrations run as Ruby code updating the database via the Rails database adapter.

  • Using sudo to Install the Postgres Gem on Leopard

    https://justatheory.com/2008/01/postgres-gem-on-leopard

  • Execute SQL Code on Connect

    https://justatheory.com/2010/04/execute-sql-on-connect

    I’ve been writing a fair bit of PL/Perl for a client, and one of the things I’ve been doing is eliminating a ton of duplicate code by creating utility functions in the %_SHARED hash. This is great, as long as the code that creates those functions gets executed at the beginning of every database connection. So I put the utility generation code into a single function, called prepare_perl_utils(). It looks something like this: