Strict Standards: Redefining already defined constructor for class wpdb in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/wp-db.php on line 49

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/cache.php on line 403

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 652

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 652

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 652

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 652

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/classes.php on line 677

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/query.php on line 15

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/theme.php on line 505

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-content/plugins/simpleflickr/phpFlickr/phpFlickr.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-content/plugins/simpleflickr/phpFlickr/phpFlickr.php on line 331

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-content/plugins/simpleflickr/phpFlickr/phpFlickr.php on line 400

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/2/d88602193/htdocs/Rebecca/wp-content/plugins/simpleflickr/phpFlickr/phpFlickr.php on line 469
Rebecca’s Ramblings » Blog Archive » How to get references, functions etc into your Rails test database


Strict Standards: mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 11

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 20

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 22

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 24

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 25

Strict Standards: mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 11

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 20

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 22

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 24

Strict Standards: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/functions.php on line 25

How to get references, functions etc into your Rails test database


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/formatting.php on line 75

Your rails app comes with 2 tasks to clone your database structure into the test database: db:test:clone, which does everything through ruby, and db:test:clone_structure, which dumps the SQL needed to recreate the database structure, then reloads it, in a DB-specific fashion. You can switch which version is run by the db:test:prepare task in environment.rb.

Find this bit:

# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby

Uncomment the last line shown above, and replace :ruby with :sql - that’s it!

If, like me, you’re using postgres databases, this does the trick - now db:test:prepare dumps the structure of your dev/production database using pg_dump -s … and loads it into the test database using psql.

A couple of caveats:

  • If you’re using functions written in a language that needs to be created after a new database is created, you must connect to your test database as a superuser, as only superusers can add languages.
  • If you’re using views in MySQL, the views are carefully removed from the dumped structure, so won’t be in your test database.

One Response to “How to get references, functions etc into your Rails test database”

  1. Greg Says:

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/2/d88602193/htdocs/Rebecca/wp-includes/formatting.php on line 75

    Thanks Rebecca. Just what I needed.

Leave a Reply