{"id":503,"date":"2010-02-26T20:05:44","date_gmt":"2010-02-26T19:05:44","guid":{"rendered":"http:\/\/www.malcolmhardie.com\/weblogs\/angus\/?p=503"},"modified":"2025-02-01T03:04:15","modified_gmt":"2025-02-01T03:04:15","slug":"rails-migrations-and-schemas","status":"publish","type":"post","link":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/2010\/02\/26\/rails-migrations-and-schemas\/","title":{"rendered":"Rails Migrations and Schemas"},"content":{"rendered":"<ul>\n<li>A schema.rb file is typically a ruby script containing a call to the <tt>ActiveRecord::Schema.define<\/tt> method.<\/li>\n<\/ul>\n<ul>\n<li> A rails migration is a ruby class which inherits from <tt>ActiveRecord::Migration<\/tt> and contains a method called up<\/li>\n<\/ul>\n<p>The useful fact that I realized only after doing some ultimately unnecessary work today is that because the schema file contains a method call, it&#8217;s actually easier to extract the information from it than with a migration (which needs SQLEditor to figure out a class name and then call the up method)<\/p>\n<p>Hopefully this new work will appear soon in SQLEditor<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A schema.rb file is typically a ruby script containing a call to the ActiveRecord::Schema.define method. A rails migration is a ruby class which inherits from ActiveRecord::Migration and contains a method called up The useful fact that I realized only after doing some ultimately unnecessary work today is that because the schema file contains a method [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,14],"tags":[59,60,65],"class_list":["post-503","post","type-post","status-publish","format-standard","hentry","category-politics","category-writing-software","tag-rails","tag-ruby","tag-sqleditor"],"_links":{"self":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/comments?post=503"}],"version-history":[{"count":1,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/503\/revisions"}],"predecessor-version":[{"id":1374,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/503\/revisions\/1374"}],"wp:attachment":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/media?parent=503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/categories?post=503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/tags?post=503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}