3 ms·
Now if only I could get this working with Postgres.app
by flog 13y ago
Now if only I could get this working with Postgres.app
- pg_bot 13y agoRunning on rails 4 it should be: $ rails g migration add_uuid_to_postgresql class AddUuidToPostgresql < ActiveRecord::Migration execute("CREATE EXTENSION uuid-ossp;") end $ rake db:migrate && rake db:test:prepare Then create a table as shown in the article, and it should work.
- Legion 13y agoFor this to work, the PG role that the Rails app is using has to be a superuser, as AFAIK only superuser roles can execute CREATE EXTENSION. Does anyone consider this an issue? I have been using non-superuser roles within my Rails apps, and using an outside superuser role to add extensions with an external tool (like pgAdmin).
- labria 13y agoYes, that's exactly I didn't include it in the migration in the example.
- wtn 13y agoThere's a shortcut in the Active Record PostgreSQLAdapter: enable_extension 'uuid-ossp'