PgEnumAttribute
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Generates a PostgreSQL enum type and Native AOT conversions for a C# enum. Labels retain member names by default; PostgreSQL ordering follows declaration order, not numeric values.
[AttributeUsage(AttributeTargets.Enum, Inherited = false)]public sealed class PgEnumAttribute : AttributeInheritance: object, Attribute
Constructors
Section titled “Constructors”PgEnumAttribute()
Section titled “PgEnumAttribute()”public PgEnumAttribute()Properties
Section titled “Properties”GenerateSql
Section titled “GenerateSql”Gets or sets whether installation SQL is emitted for the enum’s CREATE TYPE declaration. The default is true. False retains the managed enum mapping, native conversions and dependency identifier. Cannot be false when Sql contains a replacement, including an empty string.
public bool GenerateSql { get; set; }Value: bool
Gets or sets this type’s identifier in the installation dependency graph.
public string? Id { get; set; }Value: string
Gets or sets the SQL type identifier; the default is the enum name in snake_case.
public string? Name { get; set; }Value: string
Requires
Section titled “Requires”Gets or sets installation entities that must precede this type.
public string[] Requires { get; set; }Value: string[]
Schema
Section titled “Schema”Gets or sets a fixed schema. Otherwise the nearest PgSchema or extension installation schema applies.
public string? Schema { get; set; }Value: string
Gets or sets literal installation SQL replacing this enum’s CREATE TYPE declaration. Null preserves generated SQL; empty text emits no statements for this declaration.
public string? Sql { get; set; }Value: string
@MODULE_PATHNAME@ becomes MODULE_PATHNAME. Keep the declared type name, schema and labels compatible with the managed enum mapping. Consuming functions and operators remain generated.
SqlRelocatable
Section titled “SqlRelocatable”Gets or sets whether the literal Sql replacement permits moving the extension to another schema. The default is false. This option applies only to non-null Sql; fixed schemas and other non-relocatable declarations can still prevent relocation.
public bool SqlRelocatable { get; set; }Value: bool