Exemple #1
0
        protected virtual void GenerateCreateExtension(
            IPostgresExtension extension,
            IModel model,
            MigrationCommandListBuilder builder)
        {
            builder
            .Append("CREATE EXTENSION IF NOT EXISTS ")
            .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(extension.Name));

            if (extension.Schema != null)
            {
                builder
                .Append(" SCHEMA ")
                .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(extension.Schema));
            }

            if (extension.Version != null)
            {
                builder
                .Append(" VERSION ")
                .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(extension.Version));
            }

            builder.AppendLine(';');
        }
 protected virtual IEnumerable <MigrationOperation> Add([NotNull] IPostgresExtension target)
 {
     yield return(new NpgsqlCreatePostgresExtensionOperation
     {
         Schema = target.Schema,
         Name = target.Name,
         Version = target.Version
     });
 }
 protected virtual IEnumerable <MigrationOperation> Remove([NotNull] IPostgresExtension source)
 {
     yield return(new NpgsqlDropPostgresExtensionOperation {
         Name = source.Name
     });
 }
 protected virtual IEnumerable <MigrationOperation> Diff([NotNull] IPostgresExtension source, [NotNull] IPostgresExtension target)
 => Enumerable.Empty <MigrationOperation>();
Exemple #5
0
 // We don't drop PostgreSQL extensions since these may be shared across multiple contexts and
 // perhaps also non-EFCore managed entities (similar to how EFCore manages schemas).
 protected virtual IEnumerable <MigrationOperation> Remove([NotNull] IPostgresExtension source)
 => Enumerable.Empty <MigrationOperation>();