iafisher / sqliteparser

A parser for SQLite's dialect of SQL
https://sqliteparser.readthedocs.io/en/latest/
MIT License
1 stars 1 forks source link

Parse table-level `UNIQUE` constraints #7

Open iafisher opened 2 years ago

iafisher commented 2 years ago

Example would be:

CREATE TABLE people(
  first_name TEXT,
  last_name TEXT,
  UNIQUE (first_name, last_name)
);

This enforces that no rows may have both the same first_name and the same last_name.

UNIQUE constraint can also take a conflict clause, like UNIQUE (first_name, last_name) ON CONFLICT ROLLBACK.

Full documentation: https://sqlite.org/lang_createtable.html

luxint commented 2 years ago

i've implemented this now at my fork, basically the same as the primary key table constraint

iafisher commented 2 years ago

Cool, if you have a PR I'd be happy to review it.