Forum: Rails deployment schema_migrations and schema_info

Posted by Anton Anykeyev (pushist1y)
on 2009-01-08 11:35
i'm using Aptana Studio for developing my rails application, and it
generates migrations files with names like
20090107231713_name_of_migration. Sequence number of migration is
generated from current timestamp. In my development database i have
table SCHEMA_MIGRATIONS with varchar(255) field 'version'. In this table
i have list of all applied migrations and everything goes fine. But in
my production database on webserver i don't have SCHEMA_MIGRATIONS
table, i have SCHEMA_INFO instead. This table has field 'version' too,
but it's integer. Also this table doesn't seem to contain all the
applied migrations, only the last one. rake db:migrate tries to store in
this table value like 20090107231713 and failes, because it's too big fo
integer.

The main question is: is SCHEMA_INFO designed to contain only number of
last applied migration o have i some nasty bug? Will it be allright if i
convert SCHEMA_INFO.version to varchar(255)?

Also maybe someone knows, how to override Aptana's migration naming
rules to make them sequential like 00001_..., 00002_...?

thanks and sorry for my english =\
Posted by James Cowlishaw (cowlibob)
on 2009-08-18 10:03
Anton Anykeyev wrote:
> i'm using Aptana Studio for developing my rails application, and it
> generates migrations files with names like
> 20090107231713_name_of_migration. Sequence number of migration is
> generated from current timestamp. In my development database i have
> table SCHEMA_MIGRATIONS with varchar(255) field 'version'. In this table
> i have list of all applied migrations and everything goes fine. But in
> my production database on webserver i don't have SCHEMA_MIGRATIONS
> table, i have SCHEMA_INFO instead. This table has field 'version' too,
> but it's integer. Also this table doesn't seem to contain all the
> applied migrations, only the last one. rake db:migrate tries to store in
> this table value like 20090107231713 and failes, because it's too big fo
> integer.
> 
> The main question is: is SCHEMA_INFO designed to contain only number of
> last applied migration o have i some nasty bug? Will it be allright if i
> convert SCHEMA_INFO.version to varchar(255)?
> 
> Also maybe someone knows, how to override Aptana's migration naming
> rules to make them sequential like 00001_..., 00002_...?
> 
> thanks and sorry for my english =\

Seems like the migration is failing to update the database; SCHEMA_INFO 
should automatically be replaced with SCHEMA_MIGRATIONS.

Does your webserver run the correct version of rails?

Looking at the migration docs 
(http://api.rubyonrails.org/classes/ActiveRecord/Mi...), it 
shows that you can disable the datastamp migrations with:

config.active_record.timestamped_migrations = false

Hope that helps,
James.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.