Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/src/archive/design/tables/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ Use these portable, scientist-friendly types for cross-database compatibility.

- `char(n)`: fixed-length string of exactly *n* characters.
- `varchar(n)`: variable-length string up to *n* characters.
- `text`: unlimited-length text for long-form content (notes, descriptions, abstracts).
- `enum(...)`: one of several enumerated values, e.g., `enum("low", "medium", "high")`.
Do not use enums in primary keys due to difficulty changing definitions.

> **Note:** For unlimited text, use `varchar` with a generous limit, `json` for structured content,
> or `<object>` for large text files. Native SQL `text` types are supported but not portable.

**Encoding policy:** All strings use UTF-8 encoding (`utf8mb4` in MySQL, `UTF8` in PostgreSQL).
Character encoding and collation are database-level configuration, not part of type definitions.
Comparisons are case-sensitive by default.
Expand Down
4 changes: 3 additions & 1 deletion docs/src/archive/design/tables/storage-types-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ MySQL and PostgreSQL backends. Users should prefer these over native database ty
|-----------|-------------|-------|------------|
| `char(n)` | Fixed-length | `CHAR(n)` | `CHAR(n)` |
| `varchar(n)` | Variable-length | `VARCHAR(n)` | `VARCHAR(n)` |
| `text` | Unlimited text | `TEXT` | `TEXT` |

> **Note:** Native SQL `text` types (`text`, `tinytext`, `mediumtext`, `longtext`) are supported
> but not portable. Prefer `varchar(n)`, `json`, or `<object>` for portable schemas.

**Encoding:** All strings use UTF-8 (`utf8mb4` in MySQL, `UTF8` in PostgreSQL).
See [Encoding and Collation Policy](#encoding-and-collation-policy) for details.
Expand Down
4 changes: 1 addition & 3 deletions src/datajoint/declare.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
# String types (with parameters)
"char": (r"char\s*\(\d+\)$", None),
"varchar": (r"varchar\s*\(\d+\)$", None),
# Unlimited text
"text": (r"text$", None),
# Enumeration
"enum": (r"enum\s*\(.+\)$", None),
# Fixed-point decimal
Expand Down Expand Up @@ -78,7 +76,7 @@
STRING=r"(var)?char\s*\(.+\)$", # Catches char/varchar not matched by core types
TEMPORAL=r"(time|timestamp|year)(\s*\(.+\))?$", # time, timestamp, year (not date/datetime)
NATIVE_BLOB=r"(tiny|small|medium|long)blob$", # Specific blob variants
NATIVE_TEXT=r"(tiny|small|medium|long)text$", # Text variants (use plain 'text' instead)
NATIVE_TEXT=r"(tiny|small|medium|long)?text$", # Native text types (not portable)
# Codecs use angle brackets
CODEC=r"<.+>$",
).items()
Expand Down
Loading