Skip to main content

Module db

Module db 

Source
Expand description

Database-level (table/column-oriented) schema definitions. Database-level schema definitions.

This module represents what the database sees: tables, columns, indices, primary keys, storage types, and migrations. It is the counterpart to the application-level schema in [super::app], with the two layers connected by the [super::mapping] module.

§Key types

TypePurpose
SchemaCollection of all tables in a database
TableA single database table with columns, indices, and a primary key
[Column]A column within a table, including its name, type, and constraints
[Index]A database index over one or more columns
[Type]Database storage type (e.g. Integer(4), Text, VarChar(255))
[PrimaryKey]The primary key definition for a table
[Migration]A SQL migration generated from a schema diff

Schema diffing types live in [super::diff].

Structs§

AppliedMigration
Metadata about a migration that has already been applied to a database.
Column
A column in a database table.
ColumnId
Uniquely identifies a column within a schema.
EnumVariant
A single variant in a database enum type.
Index
A database index over one or more columns of a table.
IndexColumn
A single column entry within an Index.
IndexId
Uniquely identifies an index within a schema.
PrimaryKey
The primary key definition for a database table.
Schema
The complete database-level schema: a collection of tables.
Table
A database table with its columns, primary key, and indices.
TableId
Uniquely identifies a table within a Schema.
TypeEnum
A database enum type with a set of allowed values.

Enums§

IndexOp
The comparison operation used by an index column.
IndexScope
Scope of an index column, relevant for distributed databases.
Migration
A database migration generated from a diff::Schema by a driver.
Type
Database-level storage types representing how values are stored in the target database.