3 ms·
How did you deal with the migrations problem? I usually can't bisect Rails code because there's no way to migrate from here to there anymore, let alone do so au
by jaylevitt 15y ago
How did you deal with the migrations problem? I usually can't bisect Rails code because there's no way to migrate from here to there anymore, let alone do so automatically..
- snprbob86 15y agoI store the schema as SQL instead of the .rb file nightmare. Here's the script to do it quickly with Postgres & bypass the Rake slowness: #!/bin/bash root="/path/to/your/code" user='postgres' db='dev' schema="$root/db/schema.sql" pg_dump -U $user $db \ --schema=public \ --schema-only \ --no-owner \ --no-privileges \ --file $schema pg_dump -U $user $db \ --table public.schema_migrations \ --no-owner \ --data-only \ --insert \ >> $schema Then a trivial `dropdb`, `createdb`, `psql < db/schema.sql` And then a small script with 4 or 5 curl calls can get enough data into the database to drive some tests.
- jaylevitt 15y agoGah, of course. Brilliant, especially skipping rake. (Though, pro tip: With Ruby 1.9.3, set export RUBY_GC_MALLOC_LIMIT=59000000 and you'll save 5-6 seconds at launch.)