Problems testing on 1.1 and postgresql


#1

Hi,

I get errors doing this:

  1. createdb myapp_test
  2. rake db:test:clone_structure
  3. rake test:units

rake aborted!
PGError: ERROR: relation “matches” already exists

I’m using the :sql schema format because there are some problems with
postgres and the :ruby schema format

config.active_record.schema_format = :sql

It seems rake test:units is trying to create the tables again, is this a
bug?

Jeroen


#2

And if I do this:

  1. dropdb myapp_test
  2. createdb myapp_test
  3. rake test:units

I get an error:

…E…
Finished in 1.094318 seconds.

  1. Error:
    test_insert(PlayerTest):
    ActiveRecord::StatementInvalid: PGError: ERROR: relation
    “vw_player_matches” does not exist
    : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
    d.adsrc, a.attnotnull
    FROM pg_attribute a LEFT JOIN pg_attrdef d
    ON a.attrelid = d.adrelid AND a.attnum = d.adnum
    WHERE a.attrelid = ‘vw_player_matches’::regclass
    AND a.attnum > 0 AND NOT a.attisdropped
    ORDER BY a.attnum

This looks like it silently creating the db structure using the :ruby
schema format which does not dump views
(http://dev.rubyonrails.org/ticket/4112)

Jeroen


#3

I am stupid.

I didn’t actually add this:
config.active_record.schema_format = :sql

After I did it works fine.
(but there definitely is a problem with the default :ruby schema dump
format)

Jeroen