🛠️ This documentation is still under construction

Add Column

The addcolumn method allows you to add one or more columns to an existing table.

Usage

To add columns, use the addcolumn key inside an altertable definition. For each column you want to add, specify its properties just as you would in a createtable definition.

{
  "_id": "1.1.0",
  "altertable": {
    "users": {
      "addcolumn": {
        "email": {
          "type": "VARCHAR",
          "length": 255,
          "unique": true,
          "null": false
        },
        "created_at": {
          "type": "DATETIME",
          "default": "CURRENT_TIMESTAMP"
        }
      }
    }
  }
}

In this example, two new columns, email and created_at, are added to the users table.