SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Primary Key Type other than INT?

    Hello,

    I started to use Rails recently and at the moment I am focusing Mgrations.
    Is it possible to change the type of the primary key? Changing the name is fairly easy. I have data that are referencend by a char field that has unique content.

    That's what my first migration looks like.

    Code:
    def self.up
        create_table(:pages, :primary_key => :id) do |t|
          t.column :id, :string
          t.column :name, :string
          t.column :content, :string
    end
    Somebody got a hint?
    Last edited by Josti; Jun 12, 2006 at 04:40.

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think that Rails supports this. But why do you want to use a string? Maybe your problem can be solved in another way.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •