Is there a nice way in rails to automatically extract an exising database schema from an existing app and then in a new app automatically create a database based on this schema? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 8/28/06, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Is there a nice way in rails to automatically extract an exising > database schema from an existing app and then in a new app automatically > create a database based on this schema?Sure: cd /path/to/myapp rake db:schema:dump cp db/schema.rb /path/to/otherapp/db/ cd /path/to/otherapp rake db:schema:load jeremy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
rake db:schema:dump This will dump the current schema into a file called schema.rb in your db directory. On 8/28/06, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Is there a nice way in rails to automatically extract an exising > database schema from an existing app and then in a new app automatically > create a database based on this schema? > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Marlon --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> > cd /path/to/myapp > rake db:schema:dump > cp db/schema.rb /path/to/otherapp/db/ > cd /path/to/otherapp > rake db:schema:load >This is great (thx) but its not pulling over the table type. I am using MySQL and have a table with a full text index on it and the table type is MyISAM. When I do the dump/load the new table is created as InnoDB (which doesn''t support full text) Is this a known issue? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 8/29/06, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > > cd /path/to/myapp > > rake db:schema:dump > > cp db/schema.rb /path/to/otherapp/db/ > > cd /path/to/otherapp > > rake db:schema:load > > > > This is great (thx) but its not pulling over the table type. I am using > MySQL and have a table with a full text index on it and the table type > is MyISAM. When I do the dump/load the new table is created as InnoDB > (which doesn''t support full text) > > > Is this a known issue?Yes - it''s fixed in MySQL 5.1 maybe? ;-) Kidding. If you''re moving between two MySQLs, set the schema dump format to :sql in config/environment.rb. That''ll give you a ''native'' schema dump. jeremy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I know you asked for a "rails" way to do it... but gee.... mysqldump is so easy. :) On 8/29/06, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > On 8/29/06, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > > cd /path/to/myapp > > > rake db:schema:dump > > > cp db/schema.rb /path/to/otherapp/db/ > > > cd /path/to/otherapp > > > rake db:schema:load > > > > > > > This is great (thx) but its not pulling over the table type. I am using > > > > MySQL and have a table with a full text index on it and the table type > > is MyISAM. When I do the dump/load the new table is created as InnoDB > > (which doesn''t support full text) > > > > > > Is this a known issue? > > > Yes - it''s fixed in MySQL 5.1 maybe? ;-) > > Kidding. If you''re moving between two MySQLs, set the schema dump format > to :sql in config/environment.rb. That''ll give you a ''native'' schema dump. > > jeremy > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 8/29/06, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I know you asked for a "rails" way to do it... but gee.... mysqldump is so > easy. :) >Too true! Good point, Brian. jeremy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
http://digg.com/software/Ruby_on_Rails_Database_Backups_and_Exports_Tutorial Explains backups for mysql, postgresql and sqlite on both linux and windows. On 8/29/06, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > On 8/29/06, Brian Hogan <bphogan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I know you asked for a "rails" way to do it... but gee.... mysqldump is > > so easy. :) > > > > Too true! Good point, Brian. > > jeremy > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 8/29/06, Benjamin Gorlick <uncledrails-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > http://digg.com/software/Ruby_on_Rails_Database_Backups_and_Exports_Tutorial > > Explains backups for mysql, postgresql and sqlite on both linux and > windows. >I can''t tell whether you''re into Rails or driving google ad revenue. jeremy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---