# Countries primary\_key

**URL:** <https://www.ruby-forum.com/t/countries-primary-key/163030>\
**Category:** Rails\
**Created:** [March 16, 2009, 9:05pm UTC](https://www.ruby-forum.com/t/countries-primary-key/163030 "2009-03-16T21:05:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [March 16, 2009, 9:05pm UTC](https://www.ruby-forum.com/t/countries-primary-key/163030/1 "2009-03-16T21:05:07Z")

</div>

I’m using:

ActiveRecord::Base.primary\_key\_prefix\_type = :table\_name\_with\_underscore

per a design spec that I cannot change.

I wanted to create a countries table, here is my migration:

class CreateCountries \< ActiveRecord::Migration

def self.up  
create\_table :countries, :primary\_key =\> :country\_id, :force =\> true  
do |t|  
t.string :country\_name, :null =\> false, :limit =\> 48  
end  
add\_index :countries, :country\_name, :unique =\> true, :name =\>  
‘countries\_country\_name’  
end

def self.down  
drop\_table :countries  
end  
end

When I run my countries migration I get:

> rake db:migrate  
> (in /rails/foo)  
> == CreateCountries: migrating  
> ================================================  
> – add\_column(“countries”, :country\_id, :primary\_key,  
> {:precision=\>nil, :scale=\>nil, :limit=\>nil, :null=\>nil,  
> :default=\>nil})  
> rake aborted!  
> An error has occurred, all later migrations canceled:

OCIError: ORA-30649: missing DIRECTORY keyword: ALTER TABLE countries  
ADD country\_id NUMBER(38) NOT NULL PRIMARY KEY DEFAULT NULL

(See full trace by running task with --trace)

Any ideas?

Thanks,

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
