Table Unknown - SCHEMA_INFO

Hi all,
Sorry for another newbie question!
I’ve got a legacy firebird database which I wish to use, and thanks to
help from this group I’ve used Dr Nic’s Magic Models to get RoR
talking to the database.
However, I wish to create a new table (“reports”) in this database,
and so generated the scaffold such that the file “db/migrate/
001_create_reports.rb” is as follows:

class CreateReports < ActiveRecord::Migration
def self.up
create_table :reports do |t|
t.string :name
t.string :description
t.string :location
t.timestamps
end
end

def self.down
drop_table :reports
end
end

When I attempt to migrate this (rake db:migrate), I get the following
error:

FireRuby::FireRubyException: Error preparing a SQL statement.
Dynamic SQL Error
SQL error code = -204
Table unknown
SCHEMA_INFO
At line 1, column 21.
Undefined name
SQL Code = -204
Firebird Code = 335544569
: SELECT version FROM schema_info

I’ve tried running it with --trace, and going through the trace, but I
can’t make any sense out of why this is happening. I’ve also obviously
tried googling, thinking someone must have encountered this before,
but with no luck.

Thanks in advance for any help.

i can’t help you with too much details, but maybe some related info:
schema_info is a default table created by Rails. if you use an existing
db (or otherwise created, but not by rails) this will be missing.
in this table there is a single col named ‘version’ in which the current
migration state is stored (eg 1, after running your
001_create_reports.rb)

maybe it’s enough to create this table and set version to 0, but i don’t
know if it’s a good idea, to mix migrations with an existing db that way
(should do if you just add tables)

Thanks very much for your reply.
So just to clarify, I’m probably best off just scrapping what I’ve
done, adding the new table to the existing database, and starting all
over again?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs