Method ExportSchema
- Namespace
- YndigoBlue.Velocity.Engine
- Assembly
- YndigoBlue.Velocity.dll
ExportSchema(Schema, ConfigType, string, ExportConfig, bool)
Exports an entire schema including its definition and all table data to files.
public void ExportSchema(Schema schema, ConfigType configType, string dataPath, ExportConfig exportConfig = null, bool includeViews = false)
Parameters
schemaSchemaThe Schema to export.
configTypeConfigTypeThe format for the schema definition file (XML, JSON, or YAML).
dataPathstringThe directory path where schema definition and CSV data files will be created.
exportConfigExportConfigOptional ExportConfig for CSV export settings. Uses defaults if null.
includeViewsboolIf true, includes view definitions in the schema export.
Examples
using (var m = new Manager(conn))
{
var schema = m.LoadSchema("app");
// Export schema and data to folder
var exportConfig = new ExportConfig { IncludeHeaders = true };
m.ExportSchema(schema, ConfigType.Json, "./backup/app", exportConfig, includeViews: true);
Console.WriteLine("Schema exported to ./backup/app");
}
Exceptions
- DbException
Thrown when a database error occurs.