Tuesday, 15 February 2011

ruby on rails - generate activerecord schema from an existing table -


Does anyone know of a way to do this?

I have an existing table that I have created, and I would like to create a schema from that which will reproduce the table (decrease the data)

  1. Configure Database / Database. Point to the database you want to copy.
  2. rake DB: schema: dump
  3. Create an empty stay
  4. Related to schema dump, create_table Copy the line and paste it into the migration file
  5. Manually insert the migration timestamp in the schema_magration table (this applies to the current setup only because it is already a relevant table)

No comments:

Post a Comment