ruby on rails - Migrations code not generated in schema.rb? -


I had to put execute in a table migration. It looks like:

  class CreateFoos & lt; ActiveRecord :: Migration Def up_table: Make Items | T | T.integer: Bar and executed ("Select on items in other options;") End def Drawn: End of item  

This works well, but Db / schema.rb file, which must be authoritative for database creation, that line is missing from the execute command.

Am I missing something or is it the default behavior when the schema rb is generated?

I just ignored schema.rb and while deploying rake db: migrate , but I have seen recommendations to avoid doing so.

Any thoughts?

Schema of Active Records Dumpar databases handle specific ways such as foreign keys, barriers, grant details etc. Can not Change your database format to sql instead of ruby ​​. In your application.rb file:

  config.active_record.schema_format =: sql  

This is a database specific tool by using schema to db / Structure.sql . For example, if you are using PostgreSQL, it will use pg_dump to dump the schema. For the purpose of using the sql format, the dump is no longer an atheist in the database. If you wanted to migrate from PostgreSQL to MySQL, you would not be able to use the generated structure file to create a new database.

Html>

Comments