feat: add "Using the playground" section + Reference skeleton
Restructure the docs into five top-level sections, splitting the application you drive from the database language you build with. - New "Using the playground" section: command-line options; the assistive editor (completion, highlighting, [ERR]/[WRN] indicator, hints, in-line editing); the output pane (scrolling); projects (save/load/new/rebuild); undo/redo & history; export & import; clipboard; getting help. Grounded in the in-app help/usage and ADR-0003/0022/0027. - Reference: seed the remaining topic pages (Columns, Relationships, Indexes, Constraints, Inserting & editing data, Querying & inspecting) with real syntax synopses; worked examples to follow. - Surface the assistive editor on the landing page and in Getting started; restore cross-links now that targets exist. Plan + STYLE updated to the five-section structure. 24 pages, build green, links resolve, content clean; planned features carry "planned" callouts.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: Constraints
|
||||
description: NOT NULL, UNIQUE, DEFAULT, and CHECK constraints on columns.
|
||||
sidebar:
|
||||
order: 6
|
||||
---
|
||||
|
||||
:::note[In progress]
|
||||
The syntax below is complete and accurate; worked examples on the library
|
||||
schema are being added.
|
||||
:::
|
||||
|
||||
Constraints keep your data valid. Declare them in the column spec at
|
||||
`create table` / `add column` time, or change them on an existing column:
|
||||
|
||||
```rdbms-syntax
|
||||
add constraint not null to <Table>.<col>
|
||||
add constraint unique to <Table>.<col>
|
||||
add constraint default <value> to <Table>.<col>
|
||||
add constraint check (<expr>) to <Table>.<col>
|
||||
drop constraint (not null | unique | default | check) from <Table>.<col>
|
||||
```
|
||||
|
||||
Adding a constraint to a column that already has rows is checked first — if
|
||||
existing data would violate it, the change is refused and the offending rows
|
||||
are shown.
|
||||
|
||||
In advanced mode these are the standard column- and table-level constraints
|
||||
in `CREATE TABLE` / `ALTER TABLE`. The primary key is fixed at creation (see
|
||||
[Tables](/reference/tables/)).
|
||||
Reference in New Issue
Block a user