Forum: Ruby on Rails countries primary_key

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-03-16 21:05
(Received via mailing list)
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 Donald
http://destiney.com/
This topic is locked and can not be replied to.