Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[postgres] primary_key definition for AR-4.0

  • Loading branch information...
commit c801e14399a81e298b7a83b9df483fc7c1df609a 1 parent 59ae5f8
@kares kares authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/arjdbc/postgresql/adapter.rb
View
9 lib/arjdbc/postgresql/adapter.rb
@@ -1434,7 +1434,14 @@ def json(name, options = {})
class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
include ColumnMethods
-
+
+ def primary_key(name, type = :primary_key, options = {})
+ return super unless type == :uuid
+ options[:default] ||= 'uuid_generate_v4()'
+ options[:primary_key] = true
+ column name, type, options
+ end if ActiveRecord::VERSION::MAJOR > 3 # 3.2 super expects (name)
+
def column(name, type = nil, options = {})
super
column = self[name]
Please sign in to comment.
Something went wrong with that request. Please try again.