Update documentation content

This commit is contained in:
2026-03-15 05:32:05 +01:00
parent 7d10f030f3
commit c0b92596ec
30 changed files with 1840 additions and 29 deletions
@@ -0,0 +1,65 @@
---
title: Data Types | Datasquirel docs
description: SQL data types supported by Datasquirel
page_title: Data Types
page_description: All SQL data types available for table fields in Datasquirel.
---
## Overview
Every field in a Datasquirel table has a **data type** that defines what kind of values the column can store. Datasquirel is built on MariaDB, so all standard MariaDB column types are supported.
Choosing the right data type matters for:
- **Storage efficiency** — smaller types use less disk space
- **Query performance** — properly typed columns are faster to index and compare
- **Data integrity** — the database enforces type constraints automatically
## Text Types
| Type | Description |
|------|-------------|
| `VARCHAR(n)` | Variable-length string up to `n` characters. Use for short text like names, slugs, email addresses. Maximum `n` is 65,535. |
| `TEXT` | Unlimited-length text. Use for longer content like descriptions or comments. |
| `LONGTEXT` | Very large text (up to 4 GB). Use for HTML, Markdown, or JSON stored as a string. |
| `CHAR(n)` | Fixed-length string of exactly `n` characters. Padded with spaces if shorter. |
| `ENUM(...)` | A value from a predefined list (e.g. `ENUM('draft', 'published', 'archived')`). |
## Numeric Types
| Type | Description |
|------|-------------|
| `INT` | 32-bit signed integer. Range: 2,147,483,648 to 2,147,483,647. |
| `BIGINT` | 64-bit signed integer. Use for IDs that may exceed 2 billion or for large counts. |
| `TINYINT` | 8-bit integer. Range: 128 to 127. Commonly used for boolean-like flags. |
| `SMALLINT` | 16-bit integer. Range: 32,768 to 32,767. |
| `FLOAT` | Single-precision floating-point number. |
| `DOUBLE` | Double-precision floating-point number. |
| `DECIMAL(p, s)` | Exact decimal with `p` total digits and `s` decimal places. Use for money values. |
## Date and Time Types
| Type | Description |
|------|-------------|
| `DATETIME` | A date and time value (e.g. `2024-03-15 14:30:00`). |
| `DATE` | A date without time (e.g. `2024-03-15`). |
| `TIME` | A time without date (e.g. `14:30:00`). |
| `TIMESTAMP` | A Unix timestamp. Automatically updates to the current time on row modification when configured. |
## Boolean
MariaDB does not have a native BOOLEAN type. Datasquirel uses `TINYINT(1)` for boolean fields — `1` for true, `0` for false.
## Structured Data
| Type | Description |
|------|-------------|
| `JSON` | Native JSON column. MariaDB validates and stores the value as structured JSON. |
| `LONGTEXT` | Store JSON, Markdown, or HTML as plain text when native JSON validation is not needed. |
<div className="w-full grid grid-cols-1 gap-4 items-stretch">
<DocsCard
title="VARCHAR"
description="Learn more about VARCHAR and when to use it."
href="/docs/database-reference/data-types/varchar"
/>
</div>
@@ -0,0 +1,50 @@
---
title: VARCHAR | Datasquirel docs
description: Learn about the VARCHAR data type in Datasquirel
page_title: VARCHAR
page_description: Store variable-length text strings with VARCHAR columns in Datasquirel.
---
## Overview
`VARCHAR(n)` stores variable-length strings up to `n` characters. It is the most commonly used text type for short strings like names, email addresses, slugs, and status values.
## Syntax
```sql
VARCHAR(255)
```
The number in parentheses is the maximum length in characters. Common values are:
- `VARCHAR(100)` — short names, slugs, categories
- `VARCHAR(255)` — email addresses, URLs, titles
- `VARCHAR(1000)` — longer descriptions (though TEXT is often more appropriate)
The maximum allowed length is **65,535** characters, though in practice anything over a few hundred characters is better stored as `TEXT`.
## When to Use VARCHAR
Use `VARCHAR` when:
- The value is a short string with a predictable maximum length
- You plan to index the column (VARCHAR columns are faster to index than TEXT)
- The value is used in `WHERE` clauses, `ORDER BY`, or `JOIN` conditions
Use `TEXT` instead when:
- The value can be arbitrarily long (descriptions, comments, content)
- You do not need to index the full value
## In Datasquirel
When adding a field to a table, select **VARCHAR** as the data type and enter the maximum length. If no length is specified, Datasquirel defaults to `VARCHAR(255)`.
<DocsImg
alt="New Field"
srcLight="/images/screenshots/new-field-light.webp"
srcDark="/images/screenshots/new-field-dark.webp"
/>
## Notes
- VARCHAR is case-insensitive in comparisons by default (controlled by the column collation).
- Leading and trailing spaces are preserved in VARCHAR values.
- An empty string `""` is a valid VARCHAR value and is distinct from NULL.