4 ms·
I 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
by snprbob86 15y ago
I 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.)