# page.corvus.database

> Published by [corvus.page](https://lexicon.garden/identity/did:plc:3qc4cbzcriye72qqqodeda26)

✓ This is the authoritative definition for this NSID.

## Description

A database block

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.database)
- [Documentation](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.database/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:3qc4cbzcriye72qqqodeda26/page.corvus.database/examples)

## Definitions

### `page.corvus.database#row`

**Type**: `object`

A database row

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cells` | `ref` → `page.corvus.core#set` | No | The cells of the row, one per column with a value |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |

### `page.corvus.database#sql`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `text` | `ref` → `page.corvus.core#sequence` | No | The SQL query text |
| `facets` | `ref` → `page.corvus.core#set` | No | The facets applied to the SQL query |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |

### `page.corvus.database#cell`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `columnId` | `string` (at-uri) | No | The id of the column this cell belongs to |
| `valueBlockId` | `string` (at-uri) | No | The id of the value block |

### `page.corvus.database`

**Type**: `object`

A database block

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `rows` | `ref` → `page.corvus.core#set` | No | The rows of the database |
| `title` | `ref` → `page.corvus.core#sequence` | No | The name of the database |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |
| `columns` | `ref` → `page.corvus.core#sequence` | No | The columns of the database, sequence of column block ids |

### `page.corvus.database#atLink`

**Type**: `object`

A link to an ATProtocol resource

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes | The AT-URI of the linked resource |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |

### `page.corvus.database#column`

**Type**: `object`

A database column

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `ref` → `page.corvus.core#register` | No | The title of the column |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |
| `cellType` | `string` (nsid) | No | The type of the column |
| `defaults` | `ref` → `page.corvus.core#set` | No | The default properties for the column |

### `page.corvus.database#string`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `text` | `ref` → `page.corvus.core#register` | No |  |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |

### `page.corvus.database#counter`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `count` | `ref` → `page.corvus.core#counter` | No | The counter value |
| `blockId` | `string` (at-uri) | Yes | The AT-URI of this block record |

### `page.corvus.database#sqlReferenceFacet`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `sqlId` | `string` (at-uri) | No | The id of the SQL query this reference belongs to |

### `page.corvus.database#columnReferenceFacet`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `columnId` | `string` (at-uri) | No | The id of the column this reference belongs to |

### `page.corvus.database#databaseReferenceFacet`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `databaseId` | `string` (at-uri) | No | The id of the database this reference belongs to |

## Raw Schema

```json
{
  "id": "page.corvus.database",
  "defs": {
    "row": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "cells": {
          "ref": "page.corvus.core#set",
          "type": "ref",
          "description": "The cells of the row, one per column with a value"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        }
      },
      "description": "A database row"
    },
    "sql": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "text": {
          "ref": "page.corvus.core#sequence",
          "type": "ref",
          "description": "The SQL query text"
        },
        "facets": {
          "ref": "page.corvus.core#set",
          "type": "ref",
          "description": "The facets applied to the SQL query"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        }
      }
    },
    "cell": {
      "type": "object",
      "properties": {
        "columnId": {
          "type": "string",
          "format": "at-uri",
          "description": "The id of the column this cell belongs to"
        },
        "valueBlockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The id of the value block"
        }
      }
    },
    "main": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "rows": {
          "ref": "page.corvus.core#set",
          "type": "ref",
          "description": "The rows of the database"
        },
        "title": {
          "ref": "page.corvus.core#sequence",
          "type": "ref",
          "description": "The name of the database"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        },
        "columns": {
          "ref": "page.corvus.core#sequence",
          "type": "ref",
          "description": "The columns of the database, sequence of column block ids"
        }
      },
      "description": "A database block"
    },
    "atLink": {
      "type": "object",
      "required": [
        "blockId",
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of the linked resource"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        }
      },
      "description": "A link to an ATProtocol resource"
    },
    "column": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "name": {
          "ref": "page.corvus.core#register",
          "type": "ref",
          "description": "The title of the column"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        },
        "cellType": {
          "type": "string",
          "format": "nsid",
          "description": "The type of the column",
          "knownValues": [
            "page.corvus.document#prose",
            "page.corvus.contentBlocks#checkbox",
            "page.corvus.contentBlocks#code",
            "page.corvus.contentBlocks#image",
            "page.corvus.contentBlocks#atLink",
            "page.corvus.contentBlocks#blockLink"
          ]
        },
        "defaults": {
          "ref": "page.corvus.core#set",
          "type": "ref",
          "description": "The default properties for the column"
        }
      },
      "description": "A database column"
    },
    "string": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "text": {
          "ref": "page.corvus.core#register",
          "type": "ref"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        }
      }
    },
    "counter": {
      "type": "object",
      "required": [
        "blockId"
      ],
      "properties": {
        "count": {
          "ref": "page.corvus.core#counter",
          "type": "ref",
          "description": "The counter value"
        },
        "blockId": {
          "type": "string",
          "format": "at-uri",
          "description": "The AT-URI of this block record"
        }
      }
    },
    "sqlReferenceFacet": {
      "type": "object",
      "properties": {
        "sqlId": {
          "type": "string",
          "format": "at-uri",
          "description": "The id of the SQL query this reference belongs to"
        }
      }
    },
    "columnReferenceFacet": {
      "type": "object",
      "properties": {
        "columnId": {
          "type": "string",
          "format": "at-uri",
          "description": "The id of the column this reference belongs to"
        }
      }
    },
    "databaseReferenceFacet": {
      "type": "object",
      "properties": {
        "databaseId": {
          "type": "string",
          "format": "at-uri",
          "description": "The id of the database this reference belongs to"
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "description": "A database block"
}
```
