Lightweight 0.20261030.0
Loading...
Searching...
No Matches
Lightweight::SqlCreateIndexOptions Struct Reference

Optional settings for SqlMigrationQueryBuilder::CreateIndex. More...

#include <Migrate.hpp>

Public Attributes

IndexType type = IndexType::NonUnique
 Whether the index enforces uniqueness.
 
std::string whereExpression {}
 

Detailed Description

Optional settings for SqlMigrationQueryBuilder::CreateIndex.

Designed for designated initialisers, so a call only spells out what it needs:

migration.CreateIndex("idx_queue_key", "queue", { "dedup_key" },
{ .type = IndexType::Unique, .whereExpression = R"("dedup_key" <> '')" });
@ Unique
Unique index.

Definition at line 35 of file Migrate.hpp.

Member Data Documentation

◆ type

IndexType Lightweight::SqlCreateIndexOptions::type = IndexType::NonUnique

Whether the index enforces uniqueness.

Definition at line 38 of file Migrate.hpp.

◆ whereExpression

std::string Lightweight::SqlCreateIndexOptions::whereExpression {}

Predicate body of a partial (PostgreSQL / SQLite) or filtered (SQL Server) index, without the leading WHERE. Empty creates a regular index over every row. The text is emitted verbatim; the caller is responsible for dialect-safe quoting and for staying within what every target DBMS accepts (SQL Server only takes simple comparisons, IS [NOT] NULL and IN lists joined by AND).

Definition at line 45 of file Migrate.hpp.


The documentation for this struct was generated from the following file: