module Prostore::Adapter::SQLite::DDL

Overview

SQLite DDL string builders. Pure functions; no DB interaction here.

Extended Modules

Defined in:

prostore/adapter/sqlite/ddl.cr

Instance Method Summary

Instance Method Detail

def quote_ident(name : String) : String #

[View source]
def quote_string(s : String) : String #

[View source]
def render_action(action : Symbol) : String #

[View source]
def render_column(field : Schema::Field, table : String | Nil = nil) : String #

[View source]
def render_create_index(table : String, idx : Schema::Index) : String #

[View source]
def render_create_table(definition : Schema::Definition, pk_lookup : Hash(String, Array(String))) : String #

Resolve target PK columns for a model definition (for FKs that omit references_fields:). The caller passes a lookup table from references_table → primary key column names.


[View source]
def render_enum_check(field : Schema::Field, table : String | Nil = nil) : String | Nil #

Render the CHECK (...) clause that constrains an enum column to its declared member set (ADR-0016). Returns nil for non-enum fields. When a table name is supplied the constraint is emitted in named form (CONSTRAINT <name> CHECK ...) so the AlterEnumMembers step can drop and re-add it by name at migration time.


[View source]
def render_foreign_key_clause(fk : Schema::ForeignKey, target_pk_columns : Array(String)) : String #

[View source]