Sha256: 4256270307b634299ad762bb3a62cc7e29026aa556a47c2ed84531b46c5e52d2
Contents?: true
Size: 345 Bytes
Versions: 4
Compression:
Stored size: 345 Bytes
Contents
module Rein module Constraint # This module contains methods for defining primary key constraints. module PrimaryKey def add_primary_key(table, options = {}) attribute = (options[:column] || "id").to_sym sql = "ALTER TABLE #{table} ADD PRIMARY KEY (#{attribute})" execute(sql) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rein-2.1.0 | lib/rein/constraint/primary_key.rb |
rein-2.0.0 | lib/rein/constraint/primary_key.rb |
rein-1.1.0 | lib/rein/constraint/primary_key.rb |
rein-1.0.0 | lib/rein/constraint/primary_key.rb |