Ruby on Rails Sunday, April 3, 2011

Now, this is how i used the migrate command. and it shows that the
migration is successful .

Note that the name of migration is 'kmigrate' while the table is
'kusers'. "Example" is the name of the project.

I:\example>rake db:migrate
(in I:/example)
== Kmigrate: migrating =====================
== Kmigrate: migrated (0.0000s) ============

== CreateKusers: migrating =================
-- create_table(:kusers)
-> 0.0625s
== CreateKusers: migrated (0.0625s) ========


This is the code written in \db\migrate\create_kusers.rb file

class CreateKusers < ActiveRecord::Migration
def self.up
create_table :kusers do |t|
t.string "name", :limit =>25
t.string "address", :limit => 50
t.integer "age", :limit =>50
t.timestamps
end
end

def self.down
drop_table :kusers
end
end

Now, now the above database should be mentioned in the schema.rb as it
is loaded at run-time when DUMPED.
but it hows an error as follows :

ActiveRecord::Schema.define(:version => 20110402024216) do

# Could not dump table "kusers" because of following ArgumentError
# invalid date

end

instead of invalid date and could not dump in the schema file, it
should be able to shows the fields in of the table kusers.
other than that i possibly reverted thd migration and tried again, but
no luck !! But that does say that migration and revert functions are
working perfectly fine.

On Apr 3, 3:20 pm, Colin Law <clan...@googlemail.com> wrote:
> On 3 April 2011 07:42, Kaushik Kumar <iamkaushikku...@gmail.com> wrote:
>
> > Hey Colin,
>
> Could you not top post please, it makes it difficult to follow the
> thread.  Insert your reply at appropriate points in previous message.
> Thanks.
>
> > the problem that i am facing is that, after i have created the entire
> > database and the migration, i use the rake db:schema:dump command.
> > After using the rake command, the database should be visible in schema.rb as
> > i see in the tutorials. But i am unable to do that.
> > like if my database has columns like name,age,address.
> > Then it should show in the schema.rb file.
> > Instead, it shows the error as below :
> >  Could not dump table "kusers" because of following ArgumentError
> >    invalid date
>
> The error suggests that you have a date/time field with an invalid
> value;, but why it should notice that when you are dumping the schema
> I do not know.
>
> Can you post the complete output of the rake command please.  Run it
> in the console then copy and paste the compete text (including the
> command you entered) into the message.
>
> Colin

--
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@googlegroups.com.
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.

No comments:

Post a Comment