Skip to main content

Module implicit

Module implicit 

Source
Expand description

Derive implicit column specs that the user did not type but the DB still applies.

Examples we surface:

  • PRIMARY KEY columns -> NOT NULL + UNIQUE (implicit)
  • SERIAL / BIGSERIAL -> NOT NULL, auto-increment default
  • GENERATED ALWAYS AS IDENTITY -> NOT NULL, auto-increment default
  • FOREIGN KEY (col) REFERENCES other(col) -> references target

Source scan rather than AST walk because dsl-parse’s CreateTableStmt doesn’t model table-level constraints yet.

Structs§

ForeignKey
Implicit

Functions§

derive
Walk body_text (the parenthesised body of the CREATE TABLE) and derive every implicit spec attached to col that is not already explicit in its declaration.