Database-agnostic schemas
Ruby-based representation of your database schema. you can change from one database to another with no effort.
The schema generator is sort of the flip side of the new schema code in Rails 1.0. It takes a set of Rails migrations, aggregates them all together, and spits out a SQL file that describes the DB that you’d get if you ran all of the migrations.
- install schema generator gem
gem install schema_generator
- create migrate/ directory with your SQL schema. (example initial setup from Typo)
cd myapp mkdir db/migrate/ vim db/migrate/0_initial_schema.rb # or download example schema # wget -O migrations/0_initial_schema.rb \ # "http://typo.leetsoft.com/trac/file/trunk/db/migrate/0_initial_schema.rb?rev=598&format=txt" ./script/generate schema
This will create db/schema.mysql.sql , db/schema.postgresql.sql and db/schema.sqlite.sql