Are migrations used only when you''re making changes to a database? Does it just allow the developer to avoid using raw SQL when working with databases? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Mar 2, 2011 at 3:59 PM, Gaba Luschi <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Are migrations used only when you''re making changes to a database? Does > it just allow the developer to avoid using raw SQL when working with > databases? >Right. Not only does it allow the developer to use a much easier (IMO) manner to do things like add, modify columns, tables, etc, it also keeps a record of the progression of your database schema. Migrations also include the ability (assuming it is used) to roll back any changes with a command from a terminal. At times a migration may also contain data-transforming tasks or really any other ruby code one needs to write to complete the migration.> > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please, don''t forget that the migrations are also provide u a pure ruby DSL to operate over your DB structure. It means that they are also independent from the DB driver (oracle or mysql or postgres). -- Thanks, Ivan Povalyukhin On Mar 2, 2:18 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Wed, Mar 2, 2011 at 3:59 PM, Gaba Luschi <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Are migrations used only when you''re making changes to a database? Does > > it just allow the developer to avoid using raw SQL when working with > > databases? > > Right. Not only does it allow the developer to use a much easier (IMO) > manner to do things like add, modify columns, tables, etc, it also keeps a > record of the progression of your database schema. Migrations also include > the ability (assuming it is used) to roll back any changes with a command > from a terminal. At times a migration may also contain data-transforming > tasks or really any other ruby code one needs to write to complete the > migration. > > > > > > > -- > > Posted viahttp://www.ruby-forum.com/. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yes, this is the key issue on migrations: independent of DB engine. As to completely avoid the programmer using SQL: this is true when we''re talking about DDL (Data Definition Language), i.e., when we define the structure, but you can still use ''raw'' SQL when doing DML (Data Manipulation Language). This is not usually recomended, since you attach yourself to a specific DB engine, you should use an ORM like Active Record. Cheers, :jb On Thu, Mar 3, 2011 at 9:38 PM, ivanpoval <ivanpoval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Please, don''t forget that the migrations are also provide u a pure > ruby DSL to operate over your DB structure. It means that they are > also independent from the DB driver (oracle or mysql or postgres). > -- > Thanks, Ivan Povalyukhin > > On Mar 2, 2:18 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Wed, Mar 2, 2011 at 3:59 PM, Gaba Luschi <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: > > > Are migrations used only when you''re making changes to a database? > Does > > > it just allow the developer to avoid using raw SQL when working with > > > databases? > > > > Right. Not only does it allow the developer to use a much easier (IMO) > > manner to do things like add, modify columns, tables, etc, it also keeps > a > > record of the progression of your database schema. Migrations also > include > > the ability (assuming it is used) to roll back any changes with a command > > from a terminal. At times a migration may also contain data-transforming > > tasks or really any other ruby code one needs to write to complete the > > migration. > > > > > > > > > > > > > -- > > > Posted viahttp://www.ruby-forum.com/. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, Mar 9, 2011 at 1:24 PM, Jose Bonnet <jose.bonnet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yes, this is the key issue on migrations: independent of DB engine.Yeah, and the coolest thing is you become fearless of schema changes :) (assuming you also write good test coverage). Really, it is so easy to change and rename things. I have become a perfectionist on field naming whereas in the past in my non-Rails days I would cringe at having to do so...> As to completely avoid the programmer using SQL: this is true when we''re > talking about DDL (Data Definition Language), i.e., when we define the > structure, but you can still use ''raw'' SQL when doing DML (Data Manipulation > Language). This is not usually recomended, since you attach yourself to a > specific DB engine, you should use an ORM like Active Record. > > Cheers, > :jb > > > On Thu, Mar 3, 2011 at 9:38 PM, ivanpoval <ivanpoval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Please, don''t forget that the migrations are also provide u a pure >> ruby DSL to operate over your DB structure. It means that they are >> also independent from the DB driver (oracle or mysql or postgres). >> -- >> Thanks, Ivan Povalyukhin >> >> On Mar 2, 2:18 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: >> > On Wed, Mar 2, 2011 at 3:59 PM, Gaba Luschi <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> >> wrote: >> > > Are migrations used only when you''re making changes to a database? >> Does >> > > it just allow the developer to avoid using raw SQL when working with >> > > databases? >> > >> > Right. Not only does it allow the developer to use a much easier (IMO) >> > manner to do things like add, modify columns, tables, etc, it also keeps >> a >> > record of the progression of your database schema. Migrations also >> include >> > the ability (assuming it is used) to roll back any changes with a >> command >> > from a terminal. At times a migration may also contain data-transforming >> > tasks or really any other ruby code one needs to write to complete the >> > migration. >> > >> > >> > >> > >> > >> > > -- >> > > Posted viahttp://www.ruby-forum.com/. >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "Ruby on Rails: Talk" group. >> > > To post to this group, send email to >> rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > To unsubscribe from this group, send email to >> > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > For more options, visit this group at >> > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.