Adds an autoincrementing primary key column or a primary key constraint to the DDL. To just create a constraint, the first argument should be an array of column symbols specifying the primary key columns. To create an autoincrementing primary key column, a single symbol can be used. In both cases, an options hash can be used as the second argument.
If you want to create a primary key column that is not autoincrementing, you should not use this method. Instead, you should use the regular column method with a :primary_key=>true option.
If an array of column symbols is used, you can specify the :name option to name the constraint.
Examples:
primary_key(:id) primary_key([:street_number, :house_number], :name=>:some constraint_name)
# File lib/sequel/database/schema_generator.rb, line 233 def primary_key(name, *args) return composite_primary_key(name, *args) if name.is_a?(Array) @primary_key = @db.serial_primary_key_options.merge({:name => name}) if opts = args.pop opts = {:type => opts} unless opts.is_a?(Hash) if type = args.pop opts.merge!(:type => type) end @primary_key.merge!(opts) end @primary_key end