🛠️ This documentation is still under construction

Changing the primary key

Drop primary key

When removing the primary key, the AUTO_INCREMENT attribute will also automatically be removed. A AUTO_INCREMENT column is required to have a key, so only removing the primary key will result in an error.

If you wish to remove a primary key from a table, set it to null.

{
  "altertable": {
    "table-name": {
      "primary_key": null
    }
  }
}

Change primary key

To change the primary key to another column, just supply the column name.

{
  "altertable": {
    "table-name": {
      "primary_key": "column-name"
    }
  }    
}