2

I'm getting PG::UndefinedFunction: ERROR: function uuid_generate_v4() does not exist error when I try heroku rake db:migrate for my rails 4 app.

I was using SQLite for my rails app and wanted to use UUIDs, so I had ActiveUUID gem installed. when I realized I had to switch to Postgres for heroku, I went back and removed the ActiveUUID generation functions from the migration files, so I went from this:

     create_table :users, :id => false do |t|
     t.uuid :id, :primary_key => true, null: false, :limit => 32
     t.string :name, null: false

to this:

     create_table :users, :id => :uuid do |t|
     t.string :name, null: false

I also removed the ActiveUUID gem from the gem file and deleted reference to it in all my models. Followed by git add ., git commit, and git push heroku master. I even reinstalled the heroku tool belt, but I can't get rid of this error.

I also had a UUID helper file in the lib folder. I deleted this and pushed. However, when I cloned a copy of the heroku repo to see its contents, the helper file is still there.

Sorry if I've just missed something completely obvious. I learned what heroku is about two days ago and am still a total beginner with rails.

1 Answers1

2

In your Postgres command line, enter:

CREATE EXTENSION "uuid-ossp";

This will enable the Postgres UUID extension so that it will be available for your use.

steve klein
  • 2,566
  • 1
  • 14
  • 27