Unable to DUMP in schema.rb

I have created the whole database and now also created a migration
named “kmigrate”
when i use the " rake db:schema:dump " command it doesnt pop up an
error but when i log onto
schema.rb file then it pops up this error :

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

Could not dump table “kusers” because of following ArgumentError

invalid date

end

can somebody please help ?

On 2 April 2011 06:53, kaushikxkcd [email protected] wrote:

I have created the whole database and now also created a migration
named “kmigrate”
when i use the " rake db:schema:dump " command it doesnt pop up an
error but when i log onto
schema.rb file then it pops up this error :

What do you mean log onto the file? What exactly are you doing to get
the error?

Colin

Hey Colin,
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

is there some kind of date validation that i am supposed to do ?
if so, i am unaware of it. Can u guide me ?

On 3 April 2011 07:42, Kaushik K. [email protected] 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

oh, about before i was replying through e-mails, sorry.

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 3 April 2011 12:08, kaushikxkcd [email protected] wrote:

oh, about before i was replying through e-mails, sorry.

So am I, that does not stop you scrolling down to insert your reply.

Colin

Oh, i have Ubuntu. In fact, i think i have Ubuntu 10.10 Meerkut
Maverick. But its jsut that i am still not very familiar with ubuntu
and its file classification and systems to work in it.

Now, if windows is showing such problem then i think i will take ur
advice and move on to Ubuntu.

Thanks a lot, i will keep you posted.

On 3 April 2011 12:07, kaushikxkcd [email protected] wrote:

create_table :kusers do |t|
end
end
OK, I understand, it is the contents of schema.rb that contains the
error. Googling for the error message led me quickly to
Issues · brianmario/mysql2 · GitHub
I suggest you read write through that and see if it helps.
The better solution is not to use Windows for Rails development. Use
this problem as an excuse to switch to, for example, Ubuntu. You can
set your PC up to dual boot Win and Ubuntu, or run Ubuntu as a virtual
machine on windows, or the other way around. I found that after the
initial learning curve of Ubuntu my world rapidly became almost a
Windows free zone. It is great to feel in control of ones machine
again.

Colin