# Table Unknown - SCHEMA\_INFO

**URL:** <https://www.ruby-forum.com/t/table-unknown-schema-info/135599>\
**Category:** Rails\
**Created:** [April 23, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/table-unknown-schema-info/135599 "2008-04-23T14:24:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@Ashley](https://www.ruby-forum.com/u/Ashley)\
**Post date:** [April 23, 2008, 2:24pm UTC](https://www.ruby-forum.com/t/table-unknown-schema-info/135599/1 "2008-04-23T14:24:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ashley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@Ashley](https://www.ruby-forum.com/u/Ashley)\
**Post date:** [April 23, 2008, 2:40pm UTC](https://www.ruby-forum.com/t/table-unknown-schema-info/135599/2 "2008-04-23T14:40:25Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Ashley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@Ashley](https://www.ruby-forum.com/u/Ashley)\
**Post date:** [April 23, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/table-unknown-schema-info/135599/3 "2008-04-23T15:54:53Z")

</div>

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?
