Topic: Trivial but time consuming bug in migrations

Hi Guys
Running rails 3.1.3/ postgres 9.1 / pg 12.2
Putting foreign keys in migrations, I got stuck on what kept on looking like good syntax

execute <<-SQL
      ALTER TABLE redis_databases
        ADD CONSTRAINT fk_redis_databases_release_statuses
        FOREIGN KEY (release_status_id)
        REFERENCES release_statuses(id)
        ON DELETE RESTRICT
    SQL 

Two spaces after the closing SQL meant that I kept on getting a pg error. Took forever to figure out what the problem was. Hopefully this message will save someone the same heartache.

regards

dukkha

Re: Trivial but time consuming bug in migrations

Hi Again
Another migration problem with postgresql and upgrading from rails 3.0 to 3.1

My migrations were full of

def self.up

end

def self.down

end

This worked fine for migrations in 3.0 but it seems that 3.1 only accepts up and down as instance methods. Get rid of self
The error produced was

SystemStackError: stack level too deep:           SELECT tablename
          FROM pg_tables
          WHERE schemaname = ANY (current_schemas(false))
Not so helpful...

dukha