Table of Contents

Class Database

Namespace
YndigoBlue.Velocity.Model
Assembly
YndigoBlue.Velocity.dll

Represents a database containing multiple schemas.

public class Database : IEquatable<Database>
Inheritance
Database
Implements

Examples

Creating a multi-schema database:

// Create a database with multiple schemas
Database db = Database.NewDatabase("my_application");

// Create schemas for different application domains
Schema usersSchema = db.CreateSchema("users");
Schema ordersSchema = db.CreateSchema("orders");
Schema inventorySchema = db.CreateSchema("inventory");

// Define tables in users schema
Table usersTable = usersSchema.CreateTable("accounts");
usersTable.AddColumn("user_id", DataType.Long, autoGenerate: true, notNull: true);
usersTable.AddColumn("username", DataType.VarChar, size: 100, notNull: true);

// Define tables in orders schema
Table ordersTable = ordersSchema.CreateTable("orders");
ordersTable.AddColumn("order_id", DataType.Long, autoGenerate: true, notNull: true);
ordersTable.AddColumn("user_id", DataType.Long, notNull: true);

// Create cross-schema foreign key
ordersTable.AddForeignKey(
    "fk_orders_users",
    ordersTable["user_id"],
    usersTable["user_id"]
);

// Deploy all schemas together
using (Manager manager = new Manager(connection))
{
    manager.BuildDatabase(db);
}

Remarks

WARNING: Multi-schema database support is not available in the Community Edition of Velocity. It requires the Full Edition. The Community Edition supports single-schema operations only.

Database provides a higher-level abstraction for managing multiple related schemas as a single unit. This enables multi-schema applications, cross-schema relationships, and unified deployment operations.

Databases can be created programmatically using NewDatabase(string, OriginType), loaded from declarative files, or loaded from existing databases.

Properties

this[string]
Name

Gets or sets the name of the database.

Origin

Gets the origin type of this database (Memory, File, or Database).

SchemaNames
Schemas

Methods

AddSchema(Schema)
AddSchemaRange(IEnumerable<Schema>)
CreateSchema(string)
Equals(Database)

Indicates whether the current object is equal to another object of the same type.

GetSchema(string)
NewDatabase(string)
ToString()

Returns the database name as a string representation.