Path: redb/redb.Export/Flat/Model/FlatConstraints.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Export/Flat/Model/FlatConstraints.cs
----
namespace redb.Export.Flat.Model;
/// A single-column foreign key of a flat table.
public sealed class FlatForeignKey
{
/// Constraint name (already within the identifier limit).
public string Name { get; init; } = "";
/// Referencing column.
public string Column { get; init; } = "";
/// Referenced table. It may be created later than the referencing one, or be absent when its Props type is not part of the model.
public string TargetTable { get; init; } = "";
/// Referenced column.
public string TargetColumn { get; init; } = "";
/// For a RedbObject<T> reference: the Props type T the target table belongs to.
public Type? TargetPropsType { get; init; }
/// What happens to the referencing row when the referenced one is deleted.
public FlatDeleteRule OnDelete { get; init; }
}
///
/// A plain index of a flat table. The export creates one for every foreign key column that no key already
/// leads with, as EF Core does by convention: lookups by owner, parent or reference, and the checks a
/// cascading delete makes, then find the rows without reading the whole table.
///
public sealed class FlatIndex
{
/// Index name (already within the identifier limit).
public string Name { get; init; } = "";
/// Columns of the index, in order.
public IReadOnlyList Columns { get; init; } = [];
}
/// A unique constraint of a flat table.
public sealed class FlatUniqueConstraint
{
/// Constraint name (already within the identifier limit).
public string Name { get; init; } = "";
/// Columns of the constraint, in order.
public IReadOnlyList Columns { get; init; } = [];
}