Very strange. I have created a couple of models, edited the migration files and run rake db:migrate and voila, the new table is created. Now I come to create a 3rd model, edit the migration file: class CreateResumes < ActiveRecord::Migration def self.up create_table :resumes do |t| # t.column :name, :string t.column :institution, :string t.column :user_id, :integer end end def self.down drop_table :resumes end end and run rake db:migrate and it doesn''t fail it just does nothing, it creates no new table. C:\work\1hh-b>rake db:migrate -t (in C:/work/1hh-b) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump C:\work\1hh-b> Other rake commands work fine such as rake annotate_models. This isn''t the first time this has happened. It usually happens after I have done a few migrations. Because I am a noob and building simple test apps I just start a new project, copying over what I have done to date and rake db:migrate works fine. But it isn''t a satisfactory solution. Any suggestions would be great. Thanks Ambrose --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
You need to either create a new migration or roll back to the migration before the one you are editing. If you look in your db you will see a table called schema info. This has a single row with a column showing the version of your migration. If you are still developing it is fine to edit the migration, bit if you are in production the rollback could remove data so the safest approach is to generate a new migration. Niels Sent from my iPhone On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merrell-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Very strange. > > I have created a couple of models, edited the migration files and run > rake db:migrate and voila, the new table is created. > > Now I come to create a 3rd model, edit the migration file: > > class CreateResumes < ActiveRecord::Migration > def self.up > create_table :resumes do |t| > # t.column :name, :string > t.column :institution, :string > t.column :user_id, :integer > > end > end > > def self.down > drop_table :resumes > end > end > > and run rake db:migrate and it doesn''t fail it just does nothing, it > creates no new table. > > C:\work\1hh-b>rake db:migrate -t > (in C:/work/1hh-b) > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > ** Invoke db:schema:dump (first_time) > ** Invoke environment > ** Execute db:schema:dump > > C:\work\1hh-b> > > Other rake commands work fine such as rake annotate_models. > > This isn''t the first time this has happened. It usually happens after > I have done a few migrations. Because I am a noob and building simple > test apps I just start a new project, copying over what I have done to > date and rake db:migrate works fine. But it isn''t a satisfactory > solution. > > Any suggestions would be great. > > Thanks > > Ambrose > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Niels I tried creating a new migration but once again it didn''t fail but also did not create the table. The schema says I am on version 3 though I have tried 2 more migrations that have not happened. If I roll back now I will roll back to version 2 and lose a table with some test data. No big deal I guess. Is it your expectation that I will then be able to successfully perform migrations once again? I''ll try and see. Thanks Ambrose On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote:> You need to either create a new migration or roll back to the > migration before the one you are editing. If you look in your db you > will see a table called schema info. This has a single row with a > column showing the version of your migration. > > If you are still developing it is fine to edit the migration, bit if > you are in production the rollback could remove data so the safest > approach is to generate a new migration. > > Niels > > Sent from my iPhone > > On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > > > Very strange. > > > I have created a couple of models, edited the migration files and run > > rake db:migrate and voila, the new table is created. > > > Now I come to create a 3rd model, edit the migration file: > > > class CreateResumes < ActiveRecord::Migration > > def self.up > > create_table :resumes do |t| > > # t.column :name, :string > > t.column :institution, :string > > t.column :user_id, :integer > > > end > > end > > > def self.down > > drop_table :resumes > > end > > end > > > and run rake db:migrate and it doesn''t fail it just does nothing, it > > creates no new table. > > > C:\work\1hh-b>rake db:migrate -t > > (in C:/work/1hh-b) > > ** Invoke db:migrate (first_time) > > ** Invoke environment (first_time) > > ** Execute environment > > ** Execute db:migrate > > ** Invoke db:schema:dump (first_time) > > ** Invoke environment > > ** Execute db:schema:dump > > > C:\work\1hh-b> > > > Other rake commands work fine such as rake annotate_models. > > > This isn''t the first time this has happened. It usually happens after > > I have done a few migrations. Because I am a noob and building simple > > test apps I just start a new project, copying over what I have done to > > date and rake db:migrate works fine. But it isn''t a satisfactory > > solution. > > > Any suggestions would be great. > > > Thanks > > > Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
What does the new migration you just created say is the migration number? How did you create the migration? The convention is migrations are named 003NameOfMigraton where 003 refers to the migration number. Niels Sent from my iPhone On Jul 4, 2007, at 4:00 PM, Ambrose <ambrose.merrell-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Thanks Niels > > I tried creating a new migration but once again it didn''t fail but > also did not create the table. > > The schema says I am on version 3 though I have tried 2 more > migrations that have not happened. If I roll back now I will roll back > to version 2 and lose a table with some test data. No big deal I > guess. > > Is it your expectation that I will then be able to successfully > perform migrations once again? I''ll try and see. > > Thanks > > Ambrose > > On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: >> You need to either create a new migration or roll back to the >> migration before the one you are editing. If you look in your db you >> will see a table called schema info. This has a single row with a >> column showing the version of your migration. >> >> If you are still developing it is fine to edit the migration, bit if >> you are in production the rollback could remove data so the safest >> approach is to generate a new migration. >> >> Niels >> >> Sent from my iPhone >> >> On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >> wrote: >> >> >> >>> Very strange. >> >>> I have created a couple of models, edited the migration files and >>> run >>> rake db:migrate and voila, the new table is created. >> >>> Now I come to create a 3rd model, edit the migration file: >> >>> class CreateResumes < ActiveRecord::Migration >>> def self.up >>> create_table :resumes do |t| >>> # t.column :name, :string >>> t.column :institution, :string >>> t.column :user_id, :integer >> >>> end >>> end >> >>> def self.down >>> drop_table :resumes >>> end >>> end >> >>> and run rake db:migrate and it doesn''t fail it just does nothing, it >>> creates no new table. >> >>> C:\work\1hh-b>rake db:migrate -t >>> (in C:/work/1hh-b) >>> ** Invoke db:migrate (first_time) >>> ** Invoke environment (first_time) >>> ** Execute environment >>> ** Execute db:migrate >>> ** Invoke db:schema:dump (first_time) >>> ** Invoke environment >>> ** Execute db:schema:dump >> >>> C:\work\1hh-b> >> >>> Other rake commands work fine such as rake annotate_models. >> >>> This isn''t the first time this has happened. It usually happens >>> after >>> I have done a few migrations. Because I am a noob and building >>> simple >>> test apps I just start a new project, copying over what I have >>> done to >>> date and rake db:migrate works fine. But it isn''t a satisfactory >>> solution. >> >>> Any suggestions would be great. >> >>> Thanks >> >>> Ambrose > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
In the migrate directory I have got to 005. The foirst 3 moigrations worked but migration 004 and 005 did not. I just rolled back to version=2 and then ran rake db:migrate again and it created the table for 003 but once again did not create the tables for 004 or 005. No errors just did not do anything for 004 and 005. Very strange. On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote:> What does the new migration you just created say is the migration > number? > How did you create the migration? The convention is migrations are > named 003NameOfMigraton where 003 refers to the migration number. > > Niels > > Sent from my iPhone > > On Jul 4, 2007, at 4:00 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > > > > > Thanks Niels > > > I tried creating a new migration but once again it didn''t fail but > > also did not create the table. > > > The schema says I am on version 3 though I have tried 2 more > > migrations that have not happened. If I roll back now I will roll back > > to version 2 and lose a table with some test data. No big deal I > > guess. > > > Is it your expectation that I will then be able to successfully > > perform migrations once again? I''ll try and see. > > > Thanks > > > Ambrose > > > On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > >> You need to either create a new migration or roll back to the > >> migration before the one you are editing. If you look in your db you > >> will see a table called schema info. This has a single row with a > >> column showing the version of your migration. > > >> If you are still developing it is fine to edit the migration, bit if > >> you are in production the rollback could remove data so the safest > >> approach is to generate a new migration. > > >> Niels > > >> Sent from my iPhone > > >> On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > >> wrote: > > >>> Very strange. > > >>> I have created a couple of models, edited the migration files and > >>> run > >>> rake db:migrate and voila, the new table is created. > > >>> Now I come to create a 3rd model, edit the migration file: > > >>> class CreateResumes < ActiveRecord::Migration > >>> def self.up > >>> create_table :resumes do |t| > >>> # t.column :name, :string > >>> t.column :institution, :string > >>> t.column :user_id, :integer > > >>> end > >>> end > > >>> def self.down > >>> drop_table :resumes > >>> end > >>> end > > >>> and run rake db:migrate and it doesn''t fail it just does nothing, it > >>> creates no new table. > > >>> C:\work\1hh-b>rake db:migrate -t > >>> (in C:/work/1hh-b) > >>> ** Invoke db:migrate (first_time) > >>> ** Invoke environment (first_time) > >>> ** Execute environment > >>> ** Execute db:migrate > >>> ** Invoke db:schema:dump (first_time) > >>> ** Invoke environment > >>> ** Execute db:schema:dump > > >>> C:\work\1hh-b> > > >>> Other rake commands work fine such as rake annotate_models. > > >>> This isn''t the first time this has happened. It usually happens > >>> after > >>> I have done a few migrations. Because I am a noob and building > >>> simple > >>> test apps I just start a new project, copying over what I have > >>> done to > >>> date and rake db:migrate works fine. But it isn''t a satisfactory > >>> solution. > > >>> Any suggestions would be great. > > >>> Thanks > > >>> Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Be sure that you have not already created these tables before. If you have you will need to force the migration to work like so.... create_table :resumes force => true do |t| This will allow the migration to overwrite the original table, assuming that you have already previously created it. --Cory On Jul 4, 4:09 pm, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> In the migrate directory I have got to 005. The foirst 3 moigrations > worked but migration 004 and 005 did not. > > I just rolled back to version=2 and then ran rake db:migrate again and > it created the table for 003 but once again did not create the tables > for 004 or 005. No errors just did not do anything for 004 and 005. > > Very strange. > > On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > > What does the new migration you just created say is the migration > > number? > > How did you create the migration? The convention is migrations are > > named 003NameOfMigraton where 003 refers to the migration number. > > > Niels > > > Sent from my iPhone > > > On Jul 4, 2007, at 4:00 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > wrote: > > > > Thanks Niels > > > > I tried creating a new migration but once again it didn''t fail but > > > also did not create the table. > > > > The schema says I am on version 3 though I have tried 2 more > > > migrations that have not happened. If I roll back now I will roll back > > > to version 2 and lose a table with some test data. No big deal I > > > guess. > > > > Is it your expectation that I will then be able to successfully > > > perform migrations once again? I''ll try and see. > > > > Thanks > > > > Ambrose > > > > On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > >> You need to either create a new migration or roll back to the > > >> migration before the one you are editing. If you look in your db you > > >> will see a table called schema info. This has a single row with a > > >> column showing the version of your migration. > > > >> If you are still developing it is fine to edit the migration, bit if > > >> you are in production the rollback could remove data so the safest > > >> approach is to generate a new migration. > > > >> Niels > > > >> Sent from my iPhone > > > >> On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > >> wrote: > > > >>> Very strange. > > > >>> I have created a couple of models, edited the migration files and > > >>> run > > >>> rake db:migrate and voila, the new table is created. > > > >>> Now I come to create a 3rd model, edit the migration file: > > > >>> class CreateResumes < ActiveRecord::Migration > > >>> def self.up > > >>> create_table :resumes do |t| > > >>> # t.column :name, :string > > >>> t.column :institution, :string > > >>> t.column :user_id, :integer > > > >>> end > > >>> end > > > >>> def self.down > > >>> drop_table :resumes > > >>> end > > >>> end > > > >>> and run rake db:migrate and it doesn''t fail it just does nothing, it > > >>> creates no new table. > > > >>> C:\work\1hh-b>rake db:migrate -t > > >>> (in C:/work/1hh-b) > > >>> ** Invoke db:migrate (first_time) > > >>> ** Invoke environment (first_time) > > >>> ** Execute environment > > >>> ** Execute db:migrate > > >>> ** Invoke db:schema:dump (first_time) > > >>> ** Invoke environment > > >>> ** Execute db:schema:dump > > > >>> C:\work\1hh-b> > > > >>> Other rake commands work fine such as rake annotate_models. > > > >>> This isn''t the first time this has happened. It usually happens > > >>> after > > >>> I have done a few migrations. Because I am a noob and building > > >>> simple > > >>> test apps I just start a new project, copying over what I have > > >>> done to > > >>> date and rake db:migrate works fine. But it isn''t a satisfactory > > >>> solution. > > > >>> Any suggestions would be great. > > > >>> Thanks > > > >>> Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Cory - nope, they are not tables I have already created - they definitely don''t exist before or after the migration :-( I just don''t get it. I''ll use the same code when I start a new project and it will work for a while. Very frustrating. On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote:> Be sure that you have not already created these tables before. If you > have you will need to force the migration to work like so.... > > create_table :resumes force => true do |t| > > This will allow the migration to overwrite the original table, > assuming that you have already previously created it. > > --Cory > > On Jul 4, 4:09 pm, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > In the migrate directory I have got to 005. The foirst 3 moigrations > > worked but migration 004 and 005 did not. > > > I just rolled back to version=2 and then ran rake db:migrate again and > > it created the table for 003 but once again did not create the tables > > for 004 or 005. No errors just did not do anything for 004 and 005. > > > Very strange. > > > On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > > > What does the new migration you just created say is the migration > > > number? > > > How did you create the migration? The convention is migrations are > > > named 003NameOfMigraton where 003 refers to the migration number. > > > > Niels > > > > Sent from my iPhone > > > > On Jul 4, 2007, at 4:00 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > > wrote: > > > > > Thanks Niels > > > > > I tried creating a new migration but once again it didn''t fail but > > > > also did not create the table. > > > > > The schema says I am on version 3 though I have tried 2 more > > > > migrations that have not happened. If I roll back now I will roll back > > > > to version 2 and lose a table with some test data. No big deal I > > > > guess. > > > > > Is it your expectation that I will then be able to successfully > > > > perform migrations once again? I''ll try and see. > > > > > Thanks > > > > > Ambrose > > > > > On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > > >> You need to either create a new migration or roll back to the > > > >> migration before the one you are editing. If you look in your db you > > > >> will see a table called schema info. This has a single row with a > > > >> column showing the version of your migration. > > > > >> If you are still developing it is fine to edit the migration, bit if > > > >> you are in production the rollback could remove data so the safest > > > >> approach is to generate a new migration. > > > > >> Niels > > > > >> Sent from my iPhone > > > > >> On Jul 4, 2007, at 3:21 PM, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > > >> wrote: > > > > >>> Very strange. > > > > >>> I have created a couple of models, edited the migration files and > > > >>> run > > > >>> rake db:migrate and voila, the new table is created. > > > > >>> Now I come to create a 3rd model, edit the migration file: > > > > >>> class CreateResumes < ActiveRecord::Migration > > > >>> def self.up > > > >>> create_table :resumes do |t| > > > >>> # t.column :name, :string > > > >>> t.column :institution, :string > > > >>> t.column :user_id, :integer > > > > >>> end > > > >>> end > > > > >>> def self.down > > > >>> drop_table :resumes > > > >>> end > > > >>> end > > > > >>> and run rake db:migrate and it doesn''t fail it just does nothing, it > > > >>> creates no new table. > > > > >>> C:\work\1hh-b>rake db:migrate -t > > > >>> (in C:/work/1hh-b) > > > >>> ** Invoke db:migrate (first_time) > > > >>> ** Invoke environment (first_time) > > > >>> ** Execute environment > > > >>> ** Execute db:migrate > > > >>> ** Invoke db:schema:dump (first_time) > > > >>> ** Invoke environment > > > >>> ** Execute db:schema:dump > > > > >>> C:\work\1hh-b> > > > > >>> Other rake commands work fine such as rake annotate_models. > > > > >>> This isn''t the first time this has happened. It usually happens > > > >>> after > > > >>> I have done a few migrations. Because I am a noob and building > > > >>> simple > > > >>> test apps I just start a new project, copying over what I have > > > >>> done to > > > >>> date and rake db:migrate works fine. But it isn''t a satisfactory > > > >>> solution. > > > > >>> Any suggestions would be great. > > > > >>> Thanks > > > > >>> Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Anyone else have any suggestions? Thanks Ambrose On Jul 4, 7:31 pm, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hi Cory - nope, they are not tables I have already created - they > definitely don''t exist before or after the migration :-( > > I just don''t get it. I''ll use the same code when I start a new project > and it will work for a while. > > Very frustrating. > > On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote: > > > Be sure that you have not already created these tables before. If you > > have you will need to force the migration to work like so.... > > > create_table :resumes force => true do |t| > > > This will allow the migration to overwrite the original table, > > assuming that you have already previously created it. > > > --Cory > > > On Jul 4, 4:09 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > In the migrate directory I have got to 005. The foirst 3 moigrations > > > worked but migration 004 and 005 did not. > > > > I just rolled back to version=2 and then ran rake db:migrate again and > > > it created the table for 003 but once again did not create the tables > > > for 004 or 005. No errors just did not do anything for 004 and 005. > > > > Very strange. > > > > On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > > > > What does the new migration you just created say is the migration > > > > number? > > > > How did you create the migration? The convention is migrations are > > > > named 003NameOfMigraton where 003 refers to the migration number. > > > > > Niels > > > > > Sent from my iPhone > > > > > On Jul 4, 2007, at 4:00 PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > > > wrote: > > > > > > Thanks Niels > > > > > > I tried creating a new migration but once again it didn''t fail but > > > > > also did not create the table. > > > > > > The schema says I am on version 3 though I have tried 2 more > > > > > migrations that have not happened. If I roll back now I will roll back > > > > > to version 2 and lose a table with some test data. No big deal I > > > > > guess. > > > > > > Is it your expectation that I will then be able to successfully > > > > > perform migrations once again? I''ll try and see. > > > > > > Thanks > > > > > >Ambrose > > > > > > On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote: > > > > >> You need to either create a new migration or roll back to the > > > > >> migration before the one you are editing. If you look in your db you > > > > >> will see a table called schema info. This has a single row with a > > > > >> column showing the version of your migration. > > > > > >> If you are still developing it is fine to edit the migration, bit if > > > > >> you are in production the rollback could remove data so the safest > > > > >> approach is to generate a new migration. > > > > > >> Niels > > > > > >> Sent from my iPhone > > > > > >> On Jul 4, 2007, at 3:21 PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > > > >> wrote: > > > > > >>> Very strange. > > > > > >>> I have created a couple of models, edited the migration files and > > > > >>> run > > > > >>> rake db:migrate and voila, the new table is created. > > > > > >>> Now I come to create a 3rd model, edit the migration file: > > > > > >>> class CreateResumes < ActiveRecord::Migration > > > > >>> def self.up > > > > >>> create_table :resumes do |t| > > > > >>> # t.column :name, :string > > > > >>> t.column :institution, :string > > > > >>> t.column :user_id, :integer > > > > > >>> end > > > > >>> end > > > > > >>> def self.down > > > > >>> drop_table :resumes > > > > >>> end > > > > >>> end > > > > > >>> and run rake db:migrate and it doesn''t fail it just does nothing, it > > > > >>> creates no new table. > > > > > >>> C:\work\1hh-b>rake db:migrate -t > > > > >>> (in C:/work/1hh-b) > > > > >>> ** Invoke db:migrate (first_time) > > > > >>> ** Invoke environment (first_time) > > > > >>> ** Execute environment > > > > >>> ** Execute db:migrate > > > > >>> ** Invoke db:schema:dump (first_time) > > > > >>> ** Invoke environment > > > > >>> ** Execute db:schema:dump > > > > > >>> C:\work\1hh-b> > > > > > >>> Other rake commands work fine such as rake annotate_models. > > > > > >>> This isn''t the first time this has happened. It usually happens > > > > >>> after > > > > >>> I have done a few migrations. Because I am a noob and building > > > > >>> simple > > > > >>> test apps I just start a new project, copying over what I have > > > > >>> done to > > > > >>> date and rake db:migrate works fine. But it isn''t a satisfactory > > > > >>> solution. > > > > > >>> Any suggestions would be great. > > > > > >>> Thanks > > > > > >>>Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
show us a listing of your db/migrate directory. If you have the same class defined in more than one migration file (typically matching the CamelCased part of the filename after then number), then your migrations go haywire. One way around this is to use very long, descriptive names for your migrations. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org On Jul 6, 2007, at 5:34 PM, Ambrose wrote:> Anyone else have any suggestions? > > Thanks > > Ambrose > > On Jul 4, 7:31 pm, Ambrose <ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> Hi Cory - nope, they are not tables I have already created - they >> definitely don''t exist before or after the migration :-( >> >> I just don''t get it. I''ll use the same code when I start a new >> project >> and it will work for a while. >> >> Very frustrating. >> >> On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote: >> >>> Be sure that you have not already created these tables before. If >>> you >>> have you will need to force the migration to work like so.... >> >>> create_table :resumes force => true do |t| >> >>> This will allow the migration to overwrite the original table, >>> assuming that you have already previously created it. >> >>> --Cory >> >>> On Jul 4, 4:09 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >>>> In the migrate directory I have got to 005. The foirst 3 >>>> moigrations >>>> worked but migration 004 and 005 did not. >> >>>> I just rolled back to version=2 and then ran rake db:migrate >>>> again and >>>> it created the table for 003 but once again did not create the >>>> tables >>>> for 004 or 005. No errors just did not do anything for 004 and 005. >> >>>> Very strange. >> >>>> On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> >>>> wrote: >> >>>>> What does the new migration you just created say is the migration >>>>> number? >>>>> How did you create the migration? The convention is migrations >>>>> are >>>>> named 003NameOfMigraton where 003 refers to the migration number. >> >>>>> Niels >> >>>>> Sent from my iPhone >> >>>>> On Jul 4, 2007, at 4:00 PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>>>> wrote: >> >>>>>> Thanks Niels >> >>>>>> I tried creating a new migration but once again it didn''t fail >>>>>> but >>>>>> also did not create the table. >> >>>>>> The schema says I am on version 3 though I have tried 2 more >>>>>> migrations that have not happened. If I roll back now I will >>>>>> roll back >>>>>> to version 2 and lose a table with some test data. No big deal I >>>>>> guess. >> >>>>>> Is it your expectation that I will then be able to successfully >>>>>> perform migrations once again? I''ll try and see. >> >>>>>> Thanks >> >>>>>> Ambrose >> >>>>>> On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> >>>>>> wrote: >>>>>>> You need to either create a new migration or roll back to the >>>>>>> migration before the one you are editing. If you look in your >>>>>>> db you >>>>>>> will see a table called schema info. This has a single row >>>>>>> with a >>>>>>> column showing the version of your migration. >> >>>>>>> If you are still developing it is fine to edit the migration, >>>>>>> bit if >>>>>>> you are in production the rollback could remove data so the >>>>>>> safest >>>>>>> approach is to generate a new migration. >> >>>>>>> Niels >> >>>>>>> Sent from my iPhone >> >>>>>>> On Jul 4, 2007, at 3:21 >>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>>>>>> wrote: >> >>>>>>>> Very strange. >> >>>>>>>> I have created a couple of models, edited the migration >>>>>>>> files and >>>>>>>> run >>>>>>>> rake db:migrate and voila, the new table is created. >> >>>>>>>> Now I come to create a 3rd model, edit the migration file: >> >>>>>>>> class CreateResumes < ActiveRecord::Migration >>>>>>>> def self.up >>>>>>>> create_table :resumes do |t| >>>>>>>> # t.column :name, :string >>>>>>>> t.column :institution, :string >>>>>>>> t.column :user_id, :integer >> >>>>>>>> end >>>>>>>> end >> >>>>>>>> def self.down >>>>>>>> drop_table :resumes >>>>>>>> end >>>>>>>> end >> >>>>>>>> and run rake db:migrate and it doesn''t fail it just does >>>>>>>> nothing, it >>>>>>>> creates no new table. >> >>>>>>>> C:\work\1hh-b>rake db:migrate -t >>>>>>>> (in C:/work/1hh-b) >>>>>>>> ** Invoke db:migrate (first_time) >>>>>>>> ** Invoke environment (first_time) >>>>>>>> ** Execute environment >>>>>>>> ** Execute db:migrate >>>>>>>> ** Invoke db:schema:dump (first_time) >>>>>>>> ** Invoke environment >>>>>>>> ** Execute db:schema:dump >> >>>>>>>> C:\work\1hh-b> >> >>>>>>>> Other rake commands work fine such as rake annotate_models. >> >>>>>>>> This isn''t the first time this has happened. It usually happens >>>>>>>> after >>>>>>>> I have done a few migrations. Because I am a noob and building >>>>>>>> simple >>>>>>>> test apps I just start a new project, copying over what I have >>>>>>>> done to >>>>>>>> date and rake db:migrate works fine. But it isn''t a >>>>>>>> satisfactory >>>>>>>> solution. >> >>>>>>>> Any suggestions would be great. >> >>>>>>>> Thanks >> >>>>>>>> Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Rob Thanks for the reply. Here is my migrate directory listing: 001_add_sessions.rb 002_create_admins.rb 003_create_users.rb 004_create_resumes.rb 005_create_cvs.rb It didn''t apply migration 004 so I tried another migration 005 and that didn''t apply wither. I rolled back to 002 and then migrated again and it redid 003 but once again did not apply 004 or 005. I am pretty sure there is something odd going on as in the past I have created a new rails project and run the same migrations creating the same tables and it works fine. Cheers Ambrose On Jul 6, 2:54 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> show us a listing of your db/migrate directory. If you have the same > class defined in more than one migration file (typically matching the > CamelCased part of the filename after then number), then your > migrations go haywire. One way around this is to use very long, > descriptive names for your migrations. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > > On Jul 6, 2007, at 5:34 PM,Ambrosewrote: > > > Anyone else have any suggestions? > > > Thanks > > >Ambrose > > > On Jul 4, 7:31 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> Hi Cory - nope, they are not tables I have already created - they > >> definitely don''t exist before or after the migration :-( > > >> I just don''t get it. I''ll use the same code when I start a new > >> project > >> and it will work for a while. > > >> Very frustrating. > > >> On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote: > > >>> Be sure that you have not already created these tables before. If > >>> you > >>> have you will need to force the migration to work like so.... > > >>> create_table :resumes force => true do |t| > > >>> This will allow the migration to overwrite the original table, > >>> assuming that you have already previously created it. > > >>> --Cory > > >>> On Jul 4, 4:09 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > >>>> In the migrate directory I have got to 005. The foirst 3 > >>>> moigrations > >>>> worked but migration 004 and 005 did not. > > >>>> I just rolled back to version=2 and then ran rake db:migrate > >>>> again and > >>>> it created the table for 003 but once again did not create the > >>>> tables > >>>> for 004 or 005. No errors just did not do anything for 004 and 005. > > >>>> Very strange. > > >>>> On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> > >>>> wrote: > > >>>>> What does the new migration you just created say is the migration > >>>>> number? > >>>>> How did you create the migration? The convention is migrations > >>>>> are > >>>>> named 003NameOfMigraton where 003 refers to the migration number. > > >>>>> Niels > > >>>>> Sent from my iPhone > > >>>>> On Jul 4, 2007, at 4:00 PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > >>>>> wrote: > > >>>>>> Thanks Niels > > >>>>>> I tried creating a new migration but once again it didn''t fail > >>>>>> but > >>>>>> also did not create the table. > > >>>>>> The schema says I am on version 3 though I have tried 2 more > >>>>>> migrations that have not happened. If I roll back now I will > >>>>>> roll back > >>>>>> to version 2 and lose a table with some test data. No big deal I > >>>>>> guess. > > >>>>>> Is it your expectation that I will then be able to successfully > >>>>>> perform migrations once again? I''ll try and see. > > >>>>>> Thanks > > >>>>>>Ambrose > > >>>>>> On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> > >>>>>> wrote: > >>>>>>> You need to either create a new migration or roll back to the > >>>>>>> migration before the one you are editing. If you look in your > >>>>>>> db you > >>>>>>> will see a table called schema info. This has a single row > >>>>>>> with a > >>>>>>> column showing the version of your migration. > > >>>>>>> If you are still developing it is fine to edit the migration, > >>>>>>> bit if > >>>>>>> you are in production the rollback could remove data so the > >>>>>>> safest > >>>>>>> approach is to generate a new migration. > > >>>>>>> Niels > > >>>>>>> Sent from my iPhone > > >>>>>>> On Jul 4, 2007, at 3:21 > >>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > >>>>>>> wrote: > > >>>>>>>> Very strange. > > >>>>>>>> I have created a couple of models, edited the migration > >>>>>>>> files and > >>>>>>>> run > >>>>>>>> rake db:migrate and voila, the new table is created. > > >>>>>>>> Now I come to create a 3rd model, edit the migration file: > > >>>>>>>> class CreateResumes < ActiveRecord::Migration > >>>>>>>> def self.up > >>>>>>>> create_table :resumes do |t| > >>>>>>>> # t.column :name, :string > >>>>>>>> t.column :institution, :string > >>>>>>>> t.column :user_id, :integer > > >>>>>>>> end > >>>>>>>> end > > >>>>>>>> def self.down > >>>>>>>> drop_table :resumes > >>>>>>>> end > >>>>>>>> end > > >>>>>>>> and run rake db:migrate and it doesn''t fail it just does > >>>>>>>> nothing, it > >>>>>>>> creates no new table. > > >>>>>>>> C:\work\1hh-b>rake db:migrate -t > >>>>>>>> (in C:/work/1hh-b) > >>>>>>>> ** Invoke db:migrate (first_time) > >>>>>>>> ** Invoke environment (first_time) > >>>>>>>> ** Execute environment > >>>>>>>> ** Execute db:migrate > >>>>>>>> ** Invoke db:schema:dump (first_time) > >>>>>>>> ** Invoke environment > >>>>>>>> ** Execute db:schema:dump > > >>>>>>>> C:\work\1hh-b> > > >>>>>>>> Other rake commands work fine such as rake annotate_models. > > >>>>>>>> This isn''t the first time this has happened. It usually happens > >>>>>>>> after > >>>>>>>> I have done a few migrations. Because I am a noob and building > >>>>>>>> simple > >>>>>>>> test apps I just start a new project, copying over what I have > >>>>>>>> done to > >>>>>>>> date and rake db:migrate works fine. But it isn''t a > >>>>>>>> satisfactory > >>>>>>>> solution. > > >>>>>>>> Any suggestions would be great. > > >>>>>>>> Thanks > > >>>>>>>>Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 6, 2007, at 6:07 PM, Ambrose wrote:> Hi Rob > > Thanks for the reply. Here is my migrate directory listing: > > 001_add_sessions.rbclass AddSessions (right?)> 002_create_admins.rbclass CreateAdmins> 003_create_users.rbclass CreateUsers> 004_create_resumes.rbclass CreateResumes> 005_create_cvs.rbclass CreateCvs> > It didn''t apply migration 004 so I tried another migration 005 and > that didn''t apply wither. I rolled back to 002 and then migrated again > and it redid 003 but once again did not apply 004 or 005.from script/console, what does this say: puts ActiveRecord::Migrator.current_version I''m thinking it will say 3 Of course, if any of the classes don''t match the filename (more importantly, if they aren''t unique), you should *make* them unique and try again. -Rob> > I am pretty sure there is something odd going on as in the past I have > created a new rails project and run the same migrations creating the > same tables and it works fine. > > Cheers > > Ambrose > > On Jul 6, 2:54 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote: >> show us a listing of your db/migrate directory. If you have the same >> class defined in more than one migration file (typically matching the >> CamelCased part of the filename after then number), then your >> migrations go haywire. One way around this is to use very long, >> descriptive names for your migrations. >> >> -Rob >> >> Rob Biedenharn http://agileconsultingllc.com >> R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org >> >> On Jul 6, 2007, at 5:34 PM,Ambrosewrote: >> >>> Anyone else have any suggestions? >> >>> Thanks >> >>> Ambrose >> >>> On Jul 4, 7:31 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >>>> Hi Cory - nope, they are not tables I have already created - they >>>> definitely don''t exist before or after the migration :-( >> >>>> I just don''t get it. I''ll use the same code when I start a new >>>> project >>>> and it will work for a while. >> >>>> Very frustrating. >> >>>> On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote: >> >>>>> Be sure that you have not already created these tables before. If >>>>> you >>>>> have you will need to force the migration to work like so.... >> >>>>> create_table :resumes force => true do |t| >> >>>>> This will allow the migration to overwrite the original table, >>>>> assuming that you have already previously created it. >> >>>>> --Cory >> >>>>> On Jul 4, 4:09 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >>>>>> In the migrate directory I have got to 005. The foirst 3 >>>>>> moigrations >>>>>> worked but migration 004 and 005 did not. >> >>>>>> I just rolled back to version=2 and then ran rake db:migrate >>>>>> again and >>>>>> it created the table for 003 but once again did not create the >>>>>> tables >>>>>> for 004 or 005. No errors just did not do anything for 004 and >>>>>> 005. >> >>>>>> Very strange. >> >>>>>> On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> >>>>>> wrote: >> >>>>>>> What does the new migration you just created say is the >>>>>>> migration >>>>>>> number? >>>>>>> How did you create the migration? The convention is migrations >>>>>>> are >>>>>>> named 003NameOfMigraton where 003 refers to the migration >>>>>>> number. >> >>>>>>> Niels >> >>>>>>> Sent from my iPhone >> >>>>>>> On Jul 4, 2007, at 4:00 >>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>>>>>> wrote: >> >>>>>>>> Thanks Niels >> >>>>>>>> I tried creating a new migration but once again it didn''t fail >>>>>>>> but >>>>>>>> also did not create the table. >> >>>>>>>> The schema says I am on version 3 though I have tried 2 more >>>>>>>> migrations that have not happened. If I roll back now I will >>>>>>>> roll back >>>>>>>> to version 2 and lose a table with some test data. No big >>>>>>>> deal I >>>>>>>> guess. >> >>>>>>>> Is it your expectation that I will then be able to successfully >>>>>>>> perform migrations once again? I''ll try and see. >> >>>>>>>> Thanks >> >>>>>>>> Ambrose >> >>>>>>>> On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> >>>>>>>> wrote: >>>>>>>>> You need to either create a new migration or roll back to the >>>>>>>>> migration before the one you are editing. If you look in your >>>>>>>>> db you >>>>>>>>> will see a table called schema info. This has a single row >>>>>>>>> with a >>>>>>>>> column showing the version of your migration. >> >>>>>>>>> If you are still developing it is fine to edit the migration, >>>>>>>>> bit if >>>>>>>>> you are in production the rollback could remove data so the >>>>>>>>> safest >>>>>>>>> approach is to generate a new migration. >> >>>>>>>>> Niels >> >>>>>>>>> Sent from my iPhone >> >>>>>>>>> On Jul 4, 2007, at 3:21 >>>>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >>>>>>>>> wrote: >> >>>>>>>>>> Very strange. >> >>>>>>>>>> I have created a couple of models, edited the migration >>>>>>>>>> files and >>>>>>>>>> run >>>>>>>>>> rake db:migrate and voila, the new table is created. >> >>>>>>>>>> Now I come to create a 3rd model, edit the migration file: >> >>>>>>>>>> class CreateResumes < ActiveRecord::Migration >>>>>>>>>> def self.up >>>>>>>>>> create_table :resumes do |t| >>>>>>>>>> # t.column :name, :string >>>>>>>>>> t.column :institution, :string >>>>>>>>>> t.column :user_id, :integer >> >>>>>>>>>> end >>>>>>>>>> end >> >>>>>>>>>> def self.down >>>>>>>>>> drop_table :resumes >>>>>>>>>> end >>>>>>>>>> end >> >>>>>>>>>> and run rake db:migrate and it doesn''t fail it just does >>>>>>>>>> nothing, it >>>>>>>>>> creates no new table. >> >>>>>>>>>> C:\work\1hh-b>rake db:migrate -t >>>>>>>>>> (in C:/work/1hh-b) >>>>>>>>>> ** Invoke db:migrate (first_time) >>>>>>>>>> ** Invoke environment (first_time) >>>>>>>>>> ** Execute environment >>>>>>>>>> ** Execute db:migrate >>>>>>>>>> ** Invoke db:schema:dump (first_time) >>>>>>>>>> ** Invoke environment >>>>>>>>>> ** Execute db:schema:dump >> >>>>>>>>>> C:\work\1hh-b> >> >>>>>>>>>> Other rake commands work fine such as rake annotate_models. >> >>>>>>>>>> This isn''t the first time this has happened. It usually >>>>>>>>>> happens >>>>>>>>>> after >>>>>>>>>> I have done a few migrations. Because I am a noob and >>>>>>>>>> building >>>>>>>>>> simple >>>>>>>>>> test apps I just start a new project, copying over what I >>>>>>>>>> have >>>>>>>>>> done to >>>>>>>>>> date and rake db:migrate works fine. But it isn''t a >>>>>>>>>> satisfactory >>>>>>>>>> solution. >> >>>>>>>>>> Any suggestions would be great. >> >>>>>>>>>> Thanks >> >>>>>>>>>> Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Yep - all the class names you wrote are as they appear in the migration file. All the classes match the file name and are unique. The current version in schema.rb: ActiveRecord::Schema.define(:version => 3) do As I say, if I now create a new project (which I am actually going to do as I am stuffed otherwise) then all the migrations will work. It just seems that after a while it stops applying them for no apparent reason in an existing project. Crazy stuff. And very frustrating. Thanks for your input Rob. On Jul 6, 3:31 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Jul 6, 2007, at 6:07 PM,Ambrosewrote:> Hi Rob > > > Thanks for the reply. Here is my migrate directory listing: > > > 001_add_sessions.rb > > class AddSessions (right?) > > > 002_create_admins.rb > class CreateAdmins > > 003_create_users.rb > class CreateUsers > > 004_create_resumes.rb > class CreateResumes > > 005_create_cvs.rb > class CreateCvs > > > It didn''t apply migration 004 so I tried another migration 005 and > > that didn''t apply wither. I rolled back to 002 and then migrated again > > and it redid 003 but once again did not apply 004 or 005. > > from script/console, what does this say: > puts ActiveRecord::Migrator.current_version > > I''m thinking it will say 3 > > Of course, if any of the classes don''t match the filename (more > importantly, if they aren''t unique), you should *make* them unique > and try again. > > -Rob > > > > > I am pretty sure there is something odd going on as in the past I have > > created a new rails project and run the same migrations creating the > > same tables and it works fine. > > > Cheers > > >Ambrose > > > On Jul 6, 2:54 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote: > >> show us a listing of your db/migrate directory. If you have the same > >> class defined in more than one migration file (typically matching the > >> CamelCased part of the filename after then number), then your > >> migrations go haywire. One way around this is to use very long, > >> descriptive names for your migrations. > > >> -Rob > > >> Rob Biedenharn http://agileconsultingllc.com > >> R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org > > >> On Jul 6, 2007, at 5:34 PM,Ambrosewrote: > > >>> Anyone else have any suggestions? > > >>> Thanks > > >>>Ambrose > > >>> On Jul 4, 7:31 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >>>> Hi Cory - nope, they are not tables I have already created - they > >>>> definitely don''t exist before or after the migration :-( > > >>>> I just don''t get it. I''ll use the same code when I start a new > >>>> project > >>>> and it will work for a while. > > >>>> Very frustrating. > > >>>> On Jul 4, 2:15 pm, CPerry <c...-jEJZ73ctDLTqlBn2x/YWAg@public.gmane.org> wrote: > > >>>>> Be sure that you have not already created these tables before. If > >>>>> you > >>>>> have you will need to force the migration to work like so.... > > >>>>> create_table :resumes force => true do |t| > > >>>>> This will allow the migration to overwrite the original table, > >>>>> assuming that you have already previously created it. > > >>>>> --Cory > > >>>>> On Jul 4, 4:09 pm,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > >>>>>> In the migrate directory I have got to 005. The foirst 3 > >>>>>> moigrations > >>>>>> worked but migration 004 and 005 did not. > > >>>>>> I just rolled back to version=2 and then ran rake db:migrate > >>>>>> again and > >>>>>> it created the table for 003 but once again did not create the > >>>>>> tables > >>>>>> for 004 or 005. No errors just did not do anything for 004 and > >>>>>> 005. > > >>>>>> Very strange. > > >>>>>> On Jul 4, 1:06 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> > >>>>>> wrote: > > >>>>>>> What does the new migration you just created say is the > >>>>>>> migration > >>>>>>> number? > >>>>>>> How did you create the migration? The convention is migrations > >>>>>>> are > >>>>>>> named 003NameOfMigraton where 003 refers to the migration > >>>>>>> number. > > >>>>>>> Niels > > >>>>>>> Sent from my iPhone > > >>>>>>> On Jul 4, 2007, at 4:00 > >>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > >>>>>>> wrote: > > >>>>>>>> Thanks Niels > > >>>>>>>> I tried creating a new migration but once again it didn''t fail > >>>>>>>> but > >>>>>>>> also did not create the table. > > >>>>>>>> The schema says I am on version 3 though I have tried 2 more > >>>>>>>> migrations that have not happened. If I roll back now I will > >>>>>>>> roll back > >>>>>>>> to version 2 and lose a table with some test data. No big > >>>>>>>> deal I > >>>>>>>> guess. > > >>>>>>>> Is it your expectation that I will then be able to successfully > >>>>>>>> perform migrations once again? I''ll try and see. > > >>>>>>>> Thanks > > >>>>>>>>Ambrose > > >>>>>>>> On Jul 4, 12:53 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> > >>>>>>>> wrote: > >>>>>>>>> You need to either create a new migration or roll back to the > >>>>>>>>> migration before the one you are editing. If you look in your > >>>>>>>>> db you > >>>>>>>>> will see a table called schema info. This has a single row > >>>>>>>>> with a > >>>>>>>>> column showing the version of your migration. > > >>>>>>>>> If you are still developing it is fine to edit the migration, > >>>>>>>>> bit if > >>>>>>>>> you are in production the rollback could remove data so the > >>>>>>>>> safest > >>>>>>>>> approach is to generate a new migration. > > >>>>>>>>> Niels > > >>>>>>>>> Sent from my iPhone > > >>>>>>>>> On Jul 4, 2007, at 3:21 > >>>>>>>>> PM,Ambrose<ambrose.merr...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > >>>>>>>>> wrote: > > >>>>>>>>>> Very strange. > > >>>>>>>>>> I have created a couple of models, edited the migration > >>>>>>>>>> files and > >>>>>>>>>> run > >>>>>>>>>> rake db:migrate and voila, the new table is created. > > >>>>>>>>>> Now I come to create a 3rd model, edit the migration file: > > >>>>>>>>>> class CreateResumes < ActiveRecord::Migration > >>>>>>>>>> def self.up > >>>>>>>>>> create_table :resumes do |t| > >>>>>>>>>> # t.column :name, :string > >>>>>>>>>> t.column :institution, :string > >>>>>>>>>> t.column :user_id, :integer > > >>>>>>>>>> end > >>>>>>>>>> end > > >>>>>>>>>> def self.down > >>>>>>>>>> drop_table :resumes > >>>>>>>>>> end > >>>>>>>>>> end > > >>>>>>>>>> and run rake db:migrate and it doesn''t fail it just does > >>>>>>>>>> nothing, it > >>>>>>>>>> creates no new table. > > >>>>>>>>>> C:\work\1hh-b>rake db:migrate -t > >>>>>>>>>> (in C:/work/1hh-b) > >>>>>>>>>> ** Invoke db:migrate (first_time) > >>>>>>>>>> ** Invoke environment (first_time) > >>>>>>>>>> ** Execute environment > >>>>>>>>>> ** Execute db:migrate > >>>>>>>>>> ** Invoke db:schema:dump (first_time) > >>>>>>>>>> ** Invoke environment > >>>>>>>>>> ** Execute db:schema:dump > > >>>>>>>>>> C:\work\1hh-b> > > >>>>>>>>>> Other rake commands work fine such as rake annotate_models. > > >>>>>>>>>> This isn''t the first time this has happened. It usually > >>>>>>>>>> happens > >>>>>>>>>> after > >>>>>>>>>> I have done a few migrations. Because I am a noob and > >>>>>>>>>> building > >>>>>>>>>> simple > >>>>>>>>>> test apps I just start a new project, copying over what I > >>>>>>>>>> have > >>>>>>>>>> done to > >>>>>>>>>> date and rake db:migrate works fine. But it isn''t a > >>>>>>>>>> satisfactory > >>>>>>>>>> solution. > > >>>>>>>>>> Any suggestions would be great. > > >>>>>>>>>> Thanks > > >>>>>>>>>>Ambrose--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Ambrose wrote:> Yep - all the class names you wrote are as they appear in the > migration file. > > All the classes match the file name and are unique. > > The current version in schema.rb: > > ActiveRecord::Schema.define(:version => 3) do > > As I say, if I now create a new project (which I am actually going to > do as I am stuffed otherwise) then all the migrations will work. It > just seems that after a while it stops applying them for no apparent > reason in an existing project. > > Crazy stuff. And very frustrating. >You may have an environment variable called VERSION set at ''3''. This would cause rake to migrate to that version but no further. Try manually setting the version to 5, to see if that works... -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Mark I can absolutely confirm that I cannot get rake db:migrate to apply more than 3 migrations. It runs with no errors but will only apply the first 3 migrations on every new project I try. So something is clearly preventing more than 3 migrations. Where would I find this environment variable? I''ve looked in environment.rb and development.rb and database.yml For now I modified schema.rb from: ActiveRecord::Schema.define(:version => 3) do to ActiveRecord::Schema.define(:version => 5) do but still the migrations beyond 3 were not applied and the file gets modified back to: ActiveRecord::Schema.define(:version => 3) do after I rake db:migrate Thanks for your help - this is so frustrating and I''d love to just get it sorted so I can get on. Cheers Ambrose On Jul 8, 9:39 am, Mark Coleman <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ambrose wrote: > > Yep - all the class names you wrote are as they appear in the > > migration file. > > > All the classes match the file name and are unique. > > > The current version in schema.rb: > > > ActiveRecord::Schema.define(:version => 3) do > > > As I say, if I now create a new project (which I am actually going to > > do as I am stuffed otherwise) then all the migrations will work. It > > just seems that after a while it stops applying them for no apparent > > reason in an existing project. > > > Crazy stuff. And very frustrating. > > You may have an environment variable called VERSION set at ''3''. This > would cause rake to migrate to that version but no further. Try manually > setting the version to 5, to see if that works... > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try running your migrations manually. eg. ruby script/console $ require RAILS_ROOT + "/db/migrate/004_create_resumes.rb" $ CreateResumes.up Ambrose wrote:> Hi Mark > > I can absolutely confirm that I cannot get rake db:migrate to apply > more than 3 migrations. It runs with no errors but will only apply the > first 3 migrations on every new project I try. So something is clearly > preventing more than 3 migrations. > > Where would I find this environment variable? I''ve looked in > environment.rb and development.rb and database.yml > > For now I modified schema.rb from: > > ActiveRecord::Schema.define(:version => 3) do > > to > > ActiveRecord::Schema.define(:version => 5) do > > but still the migrations beyond 3 were not applied and the file gets > modified back to: > > ActiveRecord::Schema.define(:version => 3) do > > after I rake db:migrate > > Thanks for your help - this is so frustrating and I''d love to just get > it sorted so I can get on. > > Cheers > > Ambrose > > On Jul 8, 9:39 am, Mark Coleman <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Ambrose wrote:> Hi Mark > > I can absolutely confirm that I cannot get rake db:migrate to apply > more than 3 migrations. It runs with no errors but will only apply the > first 3 migrations on every new project I try. So something is clearly > preventing more than 3 migrations. > > Where would I find this environment variable? I''ve looked in > environment.rb and development.rb and database.ymlDepending on your shell environment, you can do something like $>echo $VERSION to see if the environment is set - it''s not a ruby environment variable, it would be a shell environment variable that is read when the rake command is invoked. If this is the problem, doing $>rake db:migrate VERSION=5 should bypass the problem. On a PC, environment variables are set somewhere like Control Panel>System>Advanced>Environment Variables and might have been added by anything you have installed on your PC. On Mac and *nix, a variable might be being exported from somewhere else. HTH -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Well I cannot see any environment variable listed that would seem to cause this. However I am delighted to say that: $>rake db:migrate VERSION=5 does indeed bypass the problem. I''ll run with that for now as I plan to move to a Mac soon and that should be the end of the problem I hope. Huge thanks for everyone''s help :-) Cheers Ambrose On Jul 8, 4:06 pm, Mark Coleman <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ambrose wrote: > > Hi Mark > > > I can absolutely confirm that I cannot get rake db:migrate to apply > > more than 3 migrations. It runs with no errors but will only apply the > > first 3 migrations on every new project I try. So something is clearly > > preventing more than 3 migrations. > > > Where would I find this environment variable? I''ve looked in > > environment.rb and development.rb and database.yml > > Depending on your shell environment, you can do something like > > $>echo $VERSION > > to see if the environment is set - it''s not a ruby environment variable, > it would be a shell environment variable that is read when the rake > command is invoked. If this is the problem, doing > > $>rake db:migrate VERSION=5 > > should bypass the problem. On a PC, environment variables are set > somewhere like Control Panel>System>Advanced>Environment Variables and > might have been added by anything you have installed on your PC. On Mac > and *nix, a variable might be being exported from somewhere else. > > HTH > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---