Method GetSqlBuildSchema
- Namespace
- YndigoBlue.Velocity.Engine
- Assembly
- YndigoBlue.Velocity.dll
GetSqlBuildSchema(Schema, bool, bool)
Generates the SQL script that would be used to build a schema without executing it.
public string GetSqlBuildSchema(Schema schema, bool overwrite = true, bool ignoreWarnings = false)
Parameters
schemaSchemaThe Schema to generate SQL for.
overwriteboolIf true, includes DROP statements before CREATE statements.
ignoreWarningsboolIf true, ignores warnings for unsupported operations.
Returns
- string
A string containing the complete SQL script to build the schema.
Examples
using (var m = new Manager(conn))
{
var schema = m.ReadSchemaFromFile("schema.xml", ConfigType.Xml);
// Get the SQL without executing it
string sql = m.GetSqlBuildSchema(schema, overwrite: true);
// Save to file or review
File.WriteAllText("schema_create.sql", sql);
Console.WriteLine("SQL script generated");
}
Exceptions
- DbException
Thrown when a database error occurs.