Method: MigrationConstraintHelpers#primary_key
- Defined in:
- lib/migration_helpers/lib/migration_helper.rb
#primary_key(table, field) ⇒ Object
Creates a primary key for table
, which right now HAS NOT primary key defined
table: The table name field: A field (or array of fields) of the table that will be part of the primary key
30 31 32 |
# File 'lib/migration_helpers/lib/migration_helper.rb', line 30 def primary_key(table, field) execute "ALTER TABLE #{table} ADD PRIMARY KEY(#{field_list(field)})" end |