Fixtures for inititializing db

Hi,
Is there a quick and dirty way to use fixtures inside of migrations?
I’d like to be able to blow away my db and recreate it, with some
predefined values. I know i can use a db export/import, but it looks
like fixtures would be a good fit here. I tried doing this to my
migrations:

added:
require File.dirname(FILE) + ‘/…/test_helper’

class AddANewTable < ActiveRecord::Migration
def self.up

fixtures :articles
end

but it doesn’t seem to be performing correctly. Is anyone usign this
approach? Is there a best way to do it?
Thanks,
Ben

Without db tables defined how would you identify sql column types from a
fixture file?

-Peter

Hey Ben,

Haven’t toyed with it much, but I seen a rake task for this:

[root@inimit rails]# rake -T

rake load_fixtures # Load fixtures into the current
environment’s database

HTH.

Warmest regards,
Nathan.


Nathaniel S. H. Brown Toll Free 1.877.4.INIMIT
Inimit Innovations Phone 604.724.6624
www.inimit.com Fax 604.444.9942

Thanks Nathan - yeah that is what I was looking for. Seems to be
working great.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 19, 2005, at 2:05 PM, Peter M. wrote:

Without db tables defined how would you identify sql column types
from a fixture file?

Types are inferred since they are (mostly) unambiguous. Databases’
treatment of boolean is a sore spot, however: true/false, ‘t’/‘f’,
1/0, etc etc.

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDf6soAQHALep9HFYRAvIXAJ0WBtZNFHHWL3I3sDD5hPUkQPkM4wCg2Eeq
5a3Rncqq3SKMevTmLiWdvws=
=w7bW
-----END PGP SIGNATURE-----