Whenever you get a migration error, please do *not* try and
fix the
database by hand unless you've been told to do so by
someone who is
familiar with the migrations in question.
In your case, you should simply try to run `rake migrate`
from the
command-line (use `rake migrate RAILS_ENV=production` if
you're working
in the production environment). The web admin redirection is
really just
a pretty wrapper around this command, but unfortunately
sometimes
changes to the database can break even something as simple
as the web
admin migration page. So if the page gives you an error, use
the
command-line.
Again, that command is `rake migrate
RAILS_ENV=your_environment`
-Kevin
On Sat, 29 Jul 2006, Ernie Oporto wrote:
> I want to go from my version 1004 to something 4.0
flavored.
>
> [root chewbacca logs]#gem list --local
> *** LOCAL GEMS ***
> [...]
> rails (1.1.4, 1.1.2, 1.1.0, 1.0.0, 0.14.4, 0.14.3.2969,
0.14.3, 0.14.2)
> Web-application framework with template engine,
control-flow layer,
> and ORM.
>
> I've copied my database over to a test database, and
have the "blog"
> directory set up on a test URL.
> Database.yml is set up correctly to access it. At this
point, the database
> version is 42.
> When I access /blog/admin to do the migration, I got
errors about a missing
> triggers table.
>
> ActiveRecord::StatementInvalid (Mysql::Error: Table
'typotest.triggers'
> doesn't exist: SELECT * FROM triggers WHERE (due_at
<= '2006-07-29
> 21:00:01') ):
>
>
/vendor/rails/activerecord/lib/active_record/connection_adap
ters/abstract_adapter.rb:120:in
> `log'
>
> Adding the table, I then got errors about a missing
"due_at" field which I
> should have figured from the above error.
>
> ActiveRecord::StatementInvalid (Mysql::Error: Unknown
column 'due_at' in
> 'where
> clause': SELECT * FROM triggers WHERE (due_at <=
'2006-07-29 21:01:36')
> ):
>
/vendor/rails/activerecord/lib/active_record/connection_adap
ters/abstract_ad
> apter.rb:120:in `log'
>
> Adding the due_at field as a 'datetime' type, I can
then access the admin
> page. It wants to migrate me from version 42 to 48.
> Sounds good. When I click "Update database
now", the migration dies with
> Application error Typo failed to start properly"
>
>
> The logs complain that triggers table exists. =)
Errors are this...
>
> ActiveRecord::StatementInvalid (Mysql::Error: Table
'triggers' already
> exists: CREATE TABLE triggers (`id` int(11) DEFAULT
NULL auto_increment
> PRIMARY KEY, `pending_item_id` int(11),
`pending_item_type` varchar(255),
> `due_at` datetime, `trigger_method` varchar(255))
ENGINE=InnoDB):
>
>
/vendor/rails/activerecord/lib/active_record/connection_adap
ters/abstract_adapter.rb:120:in
> `log'
>
> and this...
>
> [Sat Jul 29 21:03:40 2006] [error] [client
24.149.167.195] FastCGI: comm
> with server
"/aaa/blog/public/dispatch.fcgi" aborted: error
parsing headers:
> malformed header '== CreateTriggers migrating
> =================================================='
>
>
> I drop the triggers table and we go round again to
square one.
>
> ActiveRecord::StatementInvalid (Mysql::Error: Table
'typotest.triggers'
> doesn't exist: SELECT * FROM triggers WHERE (due_at
<= '2006-07-29
> 21:15:30') ):
>
>
/vendor/rails/activerecord/lib/active_record/connection_adap
ters/abstract_adapter.rb:120:in
> `log'
>
> What's a person to do to make this migrate right?
>
> --
> Ernie
> http://www.shokk.com/blog/
>
--
Kevin Ballard
http://kevin.sb.org
kevin sb.org
_______________________________________________
Typo-list mailing list
Typo-list rubyforge.org
http:
//rubyforge.org/mailman/listinfo/typo-list
|