Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Allow insertion of test data from the current Migration #47

Closed
josegonzalez opened this Issue February 08, 2012 · 3 comments

3 participants

Jose Diaz-Gonzalez Florian Krämer Ryan Snowden
Jose Diaz-Gonzalez

It would be useful to auto-inject data into a migration for the purposes of testing - we could turn off the injection via a flag for application-specific environments - in a similar format as what Fixture class uses. We could simply wrap around the same system for adding/removing data, as well as optionally allowing users the ability to drop all existing data.

Ryan Snowden

Thanks Jose

Florian Krämer
Collaborator

This is no feature that really belongs directly into this plugin and even what you suggest is not a good idea. Migrations are thought to evolve the database schema over a migrations live cycle. What you want is a testing feature and this can and should be done separate by using a shell for example. You can re-use the fixtures as you suggested for that. I would do it with a shell like "cake testdata inject" and "cake testdata flush".

If you still want to do to it using migrations you can read the fixture data in the before and after callbacks of a migration.

Florian Krämer burzum closed this March 22, 2012
Ryan Snowden

It would be good to be able to extend it with test data though ;) I'll work on something in a fork.. taa taa!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.