🛠️ This documentation is still under construction
Command-line Interface
Update

Updating the database

Update

A initialized database is ready to be updated. To do this run:

alphadb update

Version source

When you run this command for the first time, you will be prompted to provide a version source This can either be a path to a local JSON file or a URL.

Learn more about Version sources

For this example we'll use a very simple version source.

{
  "name": "example-db",
  "version": [{
    "_id": "1.0.0",
    "createtable": {
      "customers": {
        "primary_key": "customer_id",
        "customer_id": {
          "type": "INT",
          "a_i": true
        },
        "name": {
          "type": "VARCHAR",
          "length": 100,
          "unique": true
        },
        "created": {
          "type": "DATETIME"  
        }
      }
    },
    "default_data": {
     "customers": [
        {
          "customer_id": 1,
          "name": "John",
          "created": "2023-10-31 02:12:52.000000"
        },
        {
          "customer_id": 2,
          "name": "Brian",
          "created": "2022-02-21 11:42:19.000000"
        },
        {
          "customer_id": 3,
          "name": "Anouk",
          "created": "2021-06-12 08:13:48.000000"
        }
      ]
    }
  }]
}

This will create the following table in your database:

customer_id 🔑namecreated
1John2023-10-31 02:12:52.000000
2Brian2022-02-21 11:42:19.000000
3Anouk2021-06-12 08:13:48.000000

When you later run this command again, you can choose to use this file/URL again or add a new one.

Version source verification

By default, the update method verifies your version source before running the updates. This makes sure the update won't fail.

Although it's highly recommended not to, you can disable this feature by providing the no-verify flag. This will completely bypass the verification.