SchemaFactory
Fluent builder for schema definitions.
public static class SchemaFactory
Example
var schema = SchemaFactory.Define("MyDatabase")
.Table("users", t => t
.Column("id", PortableTypes.Uuid, c => c.PrimaryKey())
.Column("email", PortableTypes.VarChar(255), c => c.NotNull())
.Column("created_at", PortableTypes.DateTime, c => c.DefaultLql("now()"))
.Index("idx_users_email", "email", unique: true))
.Table("orders", t => t
.Column("id", PortableTypes.Int, c => c.Identity().PrimaryKey())
.Column("user_id", PortableTypes.Uuid, c => c.NotNull())
.Column("total", PortableTypes.Decimal(10, 2))
.ForeignKey("user_id", "users", "id", onDelete: ForeignKeyAction.Cascade))
.Build();
Methods
Define(string)
public static SchemaBuilder Define(string name)
Start defining a schema with the given name.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The name of the schema/database. |
Returns: SchemaBuilder - A `` for fluent configuration.