{"id":8902,"date":"2023-10-26T07:19:08","date_gmt":"2023-10-26T07:19:08","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=8902"},"modified":"2023-10-26T07:19:08","modified_gmt":"2023-10-26T07:19:08","slug":"meaning-of-7-1-in-migration","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/ruby-on-rails\/meaning-of-7-1-in-migration","title":{"rendered":"What Does [7.1] Mean in Migration"},"content":{"rendered":"<p>If you are a Rails Developer then you might have seen a decimal number in the migration file and probably no doubt that you have ignored it every time so I have. But today let\u2019s face and find it out, what it is !!!<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class AddFewColumns &lt; ActiveRecord::Migration[7.1]\r\n #data alteration codde\r\nend\r\n<\/pre>\n<p>Let\u2019s discuss what it is<br \/>\nThe <strong>[7.1] within ActiveRecord::Migration[7.1]<\/strong> specifies the version of ActiveRecord that this migration is intended to be run under.<\/p>\n<ul>\n<li aria-level=\"1\">In Rails, each major version of ActiveRecord might introduce changes or enhancements to the way migrations work or how they interact with the database. By specifying the version, you are indicating which version of ActiveRecord you expect your migration to be compatible with.<\/li>\n<li aria-level=\"1\">In this case, [7.1] suggests that the migration is intended to be run with ActiveRecord version 7.1. It helps Rails maintain compatibility as you might have migrations created with different versions of ActiveRecord in the same project.<\/li>\n<li aria-level=\"1\">It\u2019s important to note that [7.1] in this context is specific to Rails 7.1 or a later version of ActiveRecord. If you&#8217;re using a different version of Rails or ActiveRecord, the version number in the migration file may be different.<\/li>\n<\/ul>\n<p><strong>In a more simplified way<\/strong><br \/>\nImagine it like this:<\/p>\n<ul>\n<li aria-level=\"1\">You have different versions of a software tool, let\u2019s say ActiveRecord (a part of Ruby on Rails), which evolves over time.<br \/>\n(make sure you are imagining with me as per the above deal.)<\/li>\n<li aria-level=\"1\">Your migration is like a set of instructions that tells the tool how to change the database structure.<\/li>\n<li aria-level=\"1\">You want to make sure these instructions work correctly with the version of the tool you\u2019re using.<\/li>\n<li aria-level=\"1\">So, you specify [7.1] to say, &#8220;Hey, Dear migrator please use these instructions that are meant for ActiveRecord version 7.1.&#8221;<\/li>\n<\/ul>\n<p>It\u2019s like telling a recipe book which edition it\u2019s written for, making sure you follow the right steps with the right recipe. Otherwise, it can spoil your application meal.<br \/>\nSo it is what it is..!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are a Rails Developer then you might have seen a decimal number in the migration file and probably no doubt that you have ignored it every time so I have. But today let\u2019s face and find it out, what it is !!! class AddFewColumns &lt; ActiveRecord::Migration[7.1] #data alteration codde end Let\u2019s discuss what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8903,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-8902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby-on-rails"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8902"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=8902"}],"version-history":[{"count":2,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8902\/revisions"}],"predecessor-version":[{"id":8906,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/8902\/revisions\/8906"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/8903"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=8902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=8902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=8902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}