// TODO: revise this approach when https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/618 gets resolved // based on: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/blob/3.1.2/src/EFCore.MySql/Migrations/MySqlMigrationsSqlGenerator.cs#L373 protected override void Generate(MySqlCreateDatabaseOperation operation, IModel?model, MigrationCommandListBuilder builder) { if (operation == null) { throw new ArgumentNullException(nameof(operation)); } if (builder == null) { throw new ArgumentNullException(nameof(builder)); } builder .Append("CREATE DATABASE ") .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name)); // if not specified, the default character set associated with the collation is used // https://dev.mysql.com/doc/refman/8.0/en/charset-database.html if (_dbCharacterSet != null) { builder .Append(" CHARACTER SET ") .Append(_dbCharacterSet); } builder .Append(" COLLATE ") .Append(_dbCollation); builder .AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator) .EndCommand(); }
public virtual void Generate(MySqlCreateDatabaseOperation operation, IModel model, MigrationCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); builder .Append("CREATE SCHEMA ") .Append(SqlGenerationHelper.DelimitIdentifier(operation.Name)) .AppendLine(SqlGenerationHelper.BatchTerminator); }
public virtual void Generate(MySqlCreateDatabaseOperation operation, IModel model, MigrationCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); builder .Append("CREATE DATABASE ") .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name)) .Append(Dependencies.SqlGenerationHelper.StatementTerminator) .AppendLine(Dependencies.SqlGenerationHelper.BatchTerminator); EndStatement(builder); }
/// <summary> /// Builds commands for the given <see cref="MySqlCreateDatabaseOperation" /> /// by making calls on the given <see cref="MigrationCommandListBuilder" />. /// </summary> /// <param name="operation"> The operation. </param> /// <param name="model"> The target model which may be <c>null</c> if the operations exist without a model. </param> /// <param name="builder"> The command builder to use to build the commands. </param> protected virtual void Generate( [NotNull] MySqlCreateDatabaseOperation operation, [CanBeNull] IModel model, [NotNull] MigrationCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); builder .Append("CREATE DATABASE ") .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name)); builder .AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator) .EndCommand(); }