---
layout: article
title: Tables
description: Efficiently deploy your Appwrite tables using the Command-Line Tool (CLI). 
---

{% info title="Before proceeding" %}
Ensure you [**install**](/docs/tooling/command-line/installation#getting-started) the CLI, [**log in**](/docs/tooling/command-line/installation#login) to your Appwrite account, and [**initialize**](/docs/tooling/command-line/installation#initialization) your Appwrite project.
{% /info %}


Create and manage your tables using the CLI commands. The Appwrite CLI also helps you push your project's databases and tables schema from one project to another.

# Initialize table {% #initialize-table %}

Create a new table using the following command:

```sh
appwrite init tables
```

# Pull table {% #pull-table %}

You can also pull your existing Appwrite tables and databases from the Appwrite Console using the `pull` command in the folder containing your `appwrite.config.json` file.

```sh
appwrite pull tables
```

# appwrite.config.json {% #appwritejson %}

After [initializing](/docs/tooling/command-line/installation#initialization) your Appwrite project and pulling your existing tables, your `appwrite.config.json` file should look similar to the following:

```json
{
    "projectId": "<PROJECT_ID>",
    "endpoint": "https://<REGION>.cloud.appwrite.io/v1",
    "tablesDB": [
        {
            "$id": "<DATABASE_ID>",
            "name": "songs",
            "$createdAt": "2023-07-01T18:35:27.802+00:00",
            "$updatedAt": "2023-08-01T21:41:41.663+00:00",
            "enabled": true
        }
    ],
    "tables": [
        {
            "$id": "<TABLE_ID>",
            "$permissions": [
                "create(\"any\")",
                "read(\"any\")",
                "update(\"any\")",
                "delete(\"any\")"
            ],
            "databaseId": "<DATABASE_ID>",
            "name": "music",
            "enabled": true,
            "rowSecurity": false,
            "columns": [
                {
                    "key": "userID",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 100,
                    "default": null
                },
                {
                    "key": "name",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 100,
                    "default": null
                },
                {
                    "key": "cloudinaryId",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 100,
                    "default": null
                },
                {
                    "key": "user",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 100,
                    "default": null
                },
                {
                    "key": "audio",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 200,
                    "default": null
                },
                {
                    "key": "genre",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 500,
                    "default": null
                },
                {
                    "key": "artist",
                    "type": "varchar",
                    "status": "available",
                    "error": "",
                    "required": false,
                    "array": false,
                    "size": 500,
                    "default": null
                }
            ],
            "indexes": []
        }
    ]
}
```

You can also move the `tablesDB` and `tables` arrays into separate JSON files with the `includes` field.

{% arrow_link href="/docs/tooling/command-line/installation#multi-file-configuration" %}
Learn more about multi-file configuration
{% /arrow_link %}

# Push table {% #push-table %}

Use the `push` command in the folder containing your `appwrite.config.json` file to push the changes you made.


```sh
appwrite push tables
```

# Commands {% #commands %}

The tables-db command allows you to create structured tables of rows, queries, and filter lists of rows. Appwrite TablesDB CLI commands generally follow the following syntax:

```sh
appwrite tables-db [COMMAND] [OPTIONS]
```

{% table %}
* Command
* Description
---
* `list-tables [options]`
* Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results.
---
* `create-table [options]`
* Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console.
---  
* `get-table [options]`
* Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata.
---
* `update-table [options]`
* Update a table by its unique ID.
---
* `delete-table [options]`
* Delete a table by its unique ID. Only users with write permissions have access to delete this resource.
---
* `list-columns [options]`
* List columns in the table.
---
* `create-boolean-column [options]`
* Create a boolean column.
---
* `update-boolean-column [options]`
* Update a boolean column. Changing the 'default' value will not update already existing rows.
---
* `create-datetime-column [options]`
* Create a date time column according to the ISO 8601 standard.
---
* `update-datetime-column [options]`
* Update a date time column. Changing the 'default' value will not update already existing rows.
---
* `create-email-column [options]`
* Create an email column.
---
* `update-email-column [options]`
* Update an email column. Changing the 'default' value will not update already existing rows.
---
* `create-enum-column [options]`
* Create an enumeration column. The 'elements' param acts as a white-list of accepted values for this column.
---
* `update-enum-column [options]`
* Update an enum column. Changing the 'default' value will not update already existing rows.
---  
* `create-float-column [options]`
* Create a float column. Optionally, minimum and maximum values can be provided.
---
* `update-float-column [options]`
* Update a float column. Changing the 'default' value will not update already existing rows.
---  
* `create-integer-column [options]`
* Create an integer column. Optionally, minimum and maximum values can be provided.
---
* `update-integer-column [options]`
* Update an integer column. Changing the 'default' value will not update already existing rows.
---
* `create-ip-column [options]`     
* Create IP address column.
---
* `update-ip-column [options]`
* Update an ip column. Changing the 'default' value will not update already existing rows.
---
* `create-relationship-column [options]`
* Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns).
---
* `create-string-column [options]`
* Create a string column.
---
* `update-string-column [options]`
* Update a string column. Changing the 'default' value will not update already existing rows.
---
* `create-url-column [options]`          
* Create a URL column.
---
* `update-url-column [options]`
* Update an url column. Changing the 'default' value will not update already existing rows.
---
* `get-column [options]`
* Get column by ID.
---
* `delete-column [options]` 
* Deletes an column.
---
* `update-relationship-column [options]`  
* Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns).
---
* `list-indexes [options]`
* List indexes in the table.
---
* `create-index [options]`
* Creates an index on the columns listed. Your index should include all the columns you will query in a single request. Columns can be 'key', 'fulltext', and 'unique'.
---
* `get-index [options]`
* Get index by ID.
---
* `delete-index [options]`
* Delete an index.
---
* `list-table-logs [options]`
* Get the table activity logs list by its unique ID.
---
{% /table %}
