diff --git a/Directory.Build.props b/Directory.Build.props
index 51099439..8a65bc83 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,6 +1,6 @@
- 1.2.0-preview.2
- 1.2.1-preview.4
+ 1.2.0-preview.4
+ 1.2.1-preview.8
\ No newline at end of file
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/App.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/App.cs
new file mode 100644
index 00000000..6ac51919
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/App.cs
@@ -0,0 +1,38 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[NotMapped]
+public class App
+{
+ public int Id { get; set; }
+
+ public string Name { get; set; } = "";
+
+ public string Identity { get; set; } = "";
+
+ public AppTypes Type { get; set; }
+
+ public ServiceTypes ServiceType { get; set; }
+
+ public string Url { get; set; } = "";
+
+ public string SwaggerUrl { get; set; } = "";
+
+ public string Description { get; set; } = "";
+
+ public DateTime CreationTime { get; set; }
+
+ public Guid Creator { get; set; }
+
+ public DateTime ModificationTime { get; set; }
+
+ public Guid Modifier { get; set; }
+
+ private readonly List _appConfigObjects = new();
+ public IReadOnlyCollection AppConfigObjects => _appConfigObjects;
+
+ private readonly List _appSecrets = new();
+ public IReadOnlyCollection AppSecrets => _appSecrets;
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppConfigObject.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppConfigObject.cs
new file mode 100644
index 00000000..07020181
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppConfigObject.cs
@@ -0,0 +1,19 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("AppConfigObjects")]
+public class AppConfigObject : ConfigObjectBase
+{
+ [Comment("AppId")]
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int AppId { get; private set; }
+
+ public AppConfigObject(int appId, int environmentClusterId)
+ {
+ EnvironmentClusterId = environmentClusterId;
+ AppId = appId;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppPin.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppPin.cs
new file mode 100644
index 00000000..b6df4494
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppPin.cs
@@ -0,0 +1,16 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+public class AppPin : FullAggregateRoot
+{
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int AppId { get; set; }
+
+ public AppPin(int appId)
+ {
+ AppId = appId;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppSecret.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppSecret.cs
new file mode 100644
index 00000000..516aec46
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/AppSecret.cs
@@ -0,0 +1,26 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("AppSecrets")]
+public class AppSecret : FullAggregateRoot
+{
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int AppId { get; private set; }
+
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int EnvironmentId { get; private set; }
+
+ [Required]
+ [Range(1, int.MaxValue)]
+ public SecretType Type { get; private set; }
+
+ [Required]
+ public Guid EncryptionSecret { get; private set; }
+
+ [Required]
+ public Guid Secret { get; private set; }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfig.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfig.cs
new file mode 100644
index 00000000..2e14eea4
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfig.cs
@@ -0,0 +1,28 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("BizConfigs")]
+public class BizConfig : FullAggregateRoot
+{
+ [Required]
+ public string Name { get; private set; }
+
+ [Required]
+ public string Identity { get; private set; }
+
+ private readonly List _bizConfigObjects = new();
+ public IReadOnlyCollection BizConfigObjects => _bizConfigObjects;
+
+ public BizConfig(string name, string identity)
+ {
+ Name = name;
+ Identity = identity;
+ }
+
+ public void Update(string name)
+ {
+ Name = name;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfigObject.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfigObject.cs
new file mode 100644
index 00000000..f9ba328c
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/BizConfigObject.cs
@@ -0,0 +1,20 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("BizConfigObjects")]
+public class BizConfigObject : ConfigObjectBase
+{
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int BizConfigId { get; private set; }
+
+ public BizConfig BizConfig { get; private set; } = null!;
+
+ public BizConfigObject(int bizConfigId, int environmentClusterId)
+ {
+ BizConfigId = bizConfigId;
+ EnvironmentClusterId = environmentClusterId;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObject.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObject.cs
new file mode 100644
index 00000000..a7592f7f
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObject.cs
@@ -0,0 +1,116 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("ConfigObjects")]
+public class ConfigObject : FullAggregateRoot
+{
+ [Comment("Name")]
+ [Required(ErrorMessage = "Config object name is required")]
+ [StringLength(100, MinimumLength = 2, ErrorMessage = "Config object name length range is [2-100]")]
+ public string Name { get; private set; }
+
+ [Comment("Format")]
+ [Required(ErrorMessage = "Format Label Code is required")]
+ [StringLength(100, MinimumLength = 2, ErrorMessage = "Format Label Code length range is [2-100]")]
+ public string FormatLabelCode { get; private set; }
+
+ [Comment("Type")]
+ [Range(1, int.MaxValue, ErrorMessage = "Type is required")]
+ public ConfigObjectType Type { get; private set; }
+
+ [Required]
+ public bool Encryption { get; private set; }
+
+ [Required]
+ public string Content { get; private set; }
+
+ [Required]
+ public string TempContent { get; private set; }
+
+ [Comment("Relation config object Id")]
+ public int RelationConfigObjectId { get; private set; }
+
+ public bool FromRelation { get; private set; }
+
+ public PublicConfigObject PublicConfigObject { get; private set; } = null!;
+
+ public BizConfigObject BizConfigObject { get; set; } = null!;
+
+ public AppConfigObject AppConfigObject { get; private set; } = null!;
+
+ private readonly List _configObjectRelease = new();
+ public IReadOnlyCollection ConfigObjectRelease => _configObjectRelease;
+
+ public ConfigObject(string name, string formatLabelCode, ConfigObjectType type, string content, string tempContent, int relationConfigObjectId = 0, bool fromRelation = false, bool encryption = false)
+ {
+ Name = name;
+ FormatLabelCode = formatLabelCode;
+ Type = type;
+ Content = content;
+ TempContent = tempContent;
+ RelationConfigObjectId = relationConfigObjectId;
+ FromRelation = fromRelation;
+ Encryption = encryption;
+ }
+
+ public void SetConfigObjectType(ConfigObjectType type)
+ {
+ Type = type;
+ }
+
+ public void SetConfigObjectRelease(IEnumerable configObjectReleases)
+ {
+ _configObjectRelease.Clear();
+ _configObjectRelease.TryAddRange(configObjectReleases);
+ }
+
+ public void SetConfigObjectRelease(ConfigObjectRelease configObjectRelease)
+ {
+ _configObjectRelease.Clear();
+ _configObjectRelease.TryAdd(configObjectRelease);
+ }
+
+ public void UpdateContent(string content)
+ {
+ Content = content;
+ }
+
+ public void AddContent(string content, string tempContent)
+ {
+ Content = content;
+ TempContent = tempContent;
+ }
+
+ public void SetPublicConfigObject(int publicConfigId, int environmentClusterId)
+ {
+ PublicConfigObject = new PublicConfigObject(publicConfigId, environmentClusterId);
+ }
+
+ public void SetBizConfigObject(int bizId, int environmentClusterId)
+ {
+ BizConfigObject = new BizConfigObject(bizId, environmentClusterId);
+ }
+
+ public void SetAppConfigObject(int appId, int environmentClusterId)
+ {
+ AppConfigObject = new AppConfigObject(appId, environmentClusterId);
+ }
+
+ public void Revoke()
+ {
+ Content = TempContent;
+ }
+
+ public void Relation(int relationConfigObjectId)
+ {
+ RelationConfigObjectId = relationConfigObjectId;
+ FromRelation = true;
+ }
+
+ public void UnRelation()
+ {
+ RelationConfigObjectId = 0;
+ }
+}
diff --git a/src/Services/Masa.Dcc.Service/Domain/App/Aggregates/ConfigObjectBase.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectBase.cs
similarity index 92%
rename from src/Services/Masa.Dcc.Service/Domain/App/Aggregates/ConfigObjectBase.cs
rename to Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectBase.cs
index 574077e5..6d3197d8 100644
--- a/src/Services/Masa.Dcc.Service/Domain/App/Aggregates/ConfigObjectBase.cs
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectBase.cs
@@ -1,7 +1,7 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
-namespace Masa.Dcc.Service.Admin.Domain.App.Aggregates;
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
public abstract class ConfigObjectBase : FullAggregateRoot
{
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectRelease.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectRelease.cs
new file mode 100644
index 00000000..8bd695f5
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/ConfigObjectRelease.cs
@@ -0,0 +1,57 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("ConfigObjectReleases")]
+public class ConfigObjectRelease : FullAggregateRoot
+{
+ [Comment("Release type")]
+ public ReleaseType Type { get; set; }
+
+ [Comment("Config object Id")]
+ [Required(ErrorMessage = "Config object Id is required")]
+ [Range(minimum: 1, maximum: int.MaxValue, ErrorMessage = "Config object Id is required")]
+ public int ConfigObjectId { get; set; }
+
+ [Comment("Rollback From Release Id")]
+ public int FromReleaseId { get; set; }
+
+ [Comment("If it is rolled back, it will be true")]
+ public bool IsInvalid { get; set; }
+
+ [Comment("Version format is yyyyMMddHHmmss")]
+ [Required(ErrorMessage = "Version is required")]
+ public string Version { get; set; }
+
+ [Comment("Name")]
+ [Required(ErrorMessage = "Name is required", AllowEmptyStrings = true)]
+ [StringLength(100, MinimumLength = 2, ErrorMessage = "Name length range is [2-100]")]
+ public string Name { get; set; }
+
+ [Comment("Comment")]
+ [Required(ErrorMessage = "Comment is required", AllowEmptyStrings = true)]
+ [StringLength(500, MinimumLength = 0, ErrorMessage = "Comment length range is [0-500]")]
+ public string Comment { get; set; }
+
+ [Comment("Content")]
+ [Required(ErrorMessage = "Content is required", AllowEmptyStrings = true)]
+ [StringLength(int.MaxValue, MinimumLength = 1, ErrorMessage = "Content length range is [1-2147483647]")]
+ public string Content { get; set; }
+
+ public ConfigObjectRelease(int configObjectId, string name, string comment, string content, string? version = null, int fromReleaseId = 0, ReleaseType type = ReleaseType.MainRelease)
+ {
+ ConfigObjectId = configObjectId;
+ Name = name;
+ Comment = comment;
+ Content = content;
+ Version = version ?? DateTime.UtcNow.ToString("yyyyMMddHHmmss");
+ FromReleaseId = fromReleaseId;
+ Type = type;
+ }
+
+ public void Invalid()
+ {
+ IsInvalid = true;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfig.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfig.cs
new file mode 100644
index 00000000..48e44c17
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfig.cs
@@ -0,0 +1,33 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("PublicConfigs")]
+public class PublicConfig : FullAggregateRoot
+{
+ [Required]
+ public string Name { get; private set; }
+
+ [Required]
+ public string Identity { get; private set; }
+
+ [Required]
+ public string Description { get; private set; }
+
+ private readonly List _publicConfigObjects = new();
+ public IReadOnlyCollection PublicConfigObjects => _publicConfigObjects;
+
+ public PublicConfig(string name, string identity, string description = "")
+ {
+ Name = name;
+ Identity = identity;
+ Description = description;
+ }
+
+ public void Update(string name, string description)
+ {
+ Name = name;
+ Description = description;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfigObject.cs b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfigObject.cs
new file mode 100644
index 00000000..151d7201
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/App/Aggregates/PublicConfigObject.cs
@@ -0,0 +1,20 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.App.Aggregates;
+
+[Table("PublicConfigObjects")]
+public class PublicConfigObject : ConfigObjectBase
+{
+ [Required]
+ [Range(1, int.MaxValue)]
+ public int PublicConfigId { get; private set; }
+
+ public PublicConfig PublicConfig { get; private set; } = null!;
+
+ public PublicConfigObject(int publicConfigId, int environmentClusterId)
+ {
+ PublicConfigId = publicConfigId;
+ EnvironmentClusterId = environmentClusterId;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/Label/Aggregates/Label.cs b/Masa.Dcc.Infrastructure.Domain/Label/Aggregates/Label.cs
new file mode 100644
index 00000000..cd193e03
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/Label/Aggregates/Label.cs
@@ -0,0 +1,54 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.Domain.Label.Aggregates;
+
+[Table("Labels")]
+[Index(nameof(TypeCode), nameof(IsDeleted), Name = "IX_TypeCode")]
+public class Label : FullAggregateRoot
+{
+ [Comment("Code")]
+ [Required(ErrorMessage = "Label code is required")]
+ [StringLength(100, MinimumLength = 2, ErrorMessage = "Label code length range is [2-100]")]
+ public string Code { get; set; }
+
+ [Comment("Name")]
+ [Required(ErrorMessage = "Label name is required")]
+ [StringLength(100, MinimumLength = 2, ErrorMessage = "Label name length range is [2-100]")]
+ public string Name { get; private set; }
+
+ [Comment("TypeCode")]
+ [Required(ErrorMessage = "TypeCode is required")]
+ [StringLength(255, MinimumLength = 0, ErrorMessage = "TypeCode length range is [0-255]")]
+ public string TypeCode { get; private set; }
+
+ [Comment("TypeName")]
+ [Required(ErrorMessage = "TypeName is required")]
+ [StringLength(255, MinimumLength = 0, ErrorMessage = "TypeName length range is [0-255]")]
+ public string TypeName { get; private set; }
+
+ [Comment("Description")]
+ [Required(ErrorMessage = "Description is required")]
+ [StringLength(255, MinimumLength = 0, ErrorMessage = "Description length range is [0-255]")]
+ public string Description { get; private set; }
+
+ public Label(string code, string name, string typeCode, string typeName, string description = "")
+ {
+ Code = code;
+ Name = name;
+ TypeCode = typeCode;
+ TypeName = typeName;
+ Description = description;
+ }
+
+ public Label(string code, string name, string typeCode, string typeName, Guid creator, DateTime creationTime, string description = "")
+ {
+ Code = code;
+ Name = name;
+ TypeCode = typeCode;
+ TypeName = typeName;
+ Creator = creator;
+ CreationTime = creationTime;
+ Description = description;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.Domain/Masa.Dcc.Infrastructure.Domain.csproj b/Masa.Dcc.Infrastructure.Domain/Masa.Dcc.Infrastructure.Domain.csproj
new file mode 100644
index 00000000..6b9c61de
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/Masa.Dcc.Infrastructure.Domain.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Masa.Dcc.Infrastructure.Domain/_Imports.cs b/Masa.Dcc.Infrastructure.Domain/_Imports.cs
new file mode 100644
index 00000000..b645f07d
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.Domain/_Imports.cs
@@ -0,0 +1,10 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+global using System.ComponentModel.DataAnnotations;
+global using System.ComponentModel.DataAnnotations.Schema;
+global using Masa.BuildingBlocks.Ddd.Domain.Entities.Full;
+global using Masa.BuildingBlocks.StackSdks.Pm.Enum;
+global using Masa.BuildingBlocks.StackSdks.Pm.Model;
+global using Masa.Dcc.Contracts.Admin.App.Enums;
+global using Microsoft.EntityFrameworkCore;
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/DccDbPostGreSqlContextFactory.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/DccDbPostGreSqlContextFactory.cs
new file mode 100644
index 00000000..74025c28
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/DccDbPostGreSqlContextFactory.cs
@@ -0,0 +1,20 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Service.Admin.Infrastructure;
+
+internal class DccDbPostGreSqlContextFactory : IDesignTimeDbContextFactory
+{
+ public DccDbContext CreateDbContext(string[] args)
+ {
+ DccDbContext.RegistAssembly(typeof(DccDbPostGreSqlContextFactory).Assembly);
+ var optionsBuilder = new MasaDbContextOptionsBuilder();
+ var configurationBuilder = new ConfigurationBuilder();
+ var configuration = configurationBuilder
+ .AddJsonFile("appsettings.json")
+ .Build();
+ optionsBuilder.DbContextOptionsBuilder.UseNpgsql(configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Masa.Dcc.Infrastructure.EFCore.PostgreSql"));
+
+ return new DccDbContext(optionsBuilder.MasaOptions);
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs
new file mode 100644
index 00000000..e9c3271d
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppConfigEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class AppConfigEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs
new file mode 100644
index 00000000..ef823e25
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppPinEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class AppPinEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs
new file mode 100644
index 00000000..6b23c5fd
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/AppSecretEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class AppSecretEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs
new file mode 100644
index 00000000..72466d91
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectEntityTypeConfiguration.cs
@@ -0,0 +1,13 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class ConfigObjectEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.Property(m => m.Content).HasColumnType("text");
+ builder.Property(m => m.TempContent).HasColumnType("text");
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs
new file mode 100644
index 00000000..f610c14c
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/ConfigObjectReleaseEntityTypeConfiguration.cs
@@ -0,0 +1,16 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class ConfigObjectReleaseEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.Property(m => m.Type).HasColumnType("smallint");
+ builder.Property(m => m.Version).HasColumnType("varchar(20)");
+ builder.Property(m => m.Name).HasColumnType("varchar(200)");
+ builder.Property(m => m.Comment).HasColumnType("varchar(1000)");
+ builder.Property(m => m.Content).HasColumnType("text");
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs
new file mode 100644
index 00000000..26661dee
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class PublicConfigEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs
new file mode 100644
index 00000000..ec26dc5d
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/App/PublicConfigObjectEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.App;
+
+internal class PublicConfigObjectEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs
new file mode 100644
index 00000000..e5493e91
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/EntityConfigurations/Label/LabelEntityTypeConfiguration.cs
@@ -0,0 +1,11 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.EntityConfigurations.Label;
+
+internal class LabelEntityTypeConfiguration : IEntityTypeConfiguration
+{
+ public void Configure(EntityTypeBuilder builder)
+ {
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Extensition.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Extensition.cs
new file mode 100644
index 00000000..e9ecbf3c
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Extensition.cs
@@ -0,0 +1,71 @@
+// Copyright (c) MASA Stack All rights reserved.
+// Licensed under the Apache License. See LICENSE.txt in the project root for license information.
+
+namespace Microsoft.Extensions.DependencyInjection;
+
+public static class DccPgsqlExtensition
+{
+ public static MasaDbContextBuilder UsePgsql(
+ this MasaDbContextBuilder builder,
+ Action? sqlServerOptionsAction = null)
+ {
+ var name = ConnectionStringNameAttribute.GetConnStringName(builder.DbContextType);
+ builder.Builder = (serviceProvider, dbContextOptionsBuilder) =>
+ {
+ var connectionStringProvider = serviceProvider.GetRequiredService();
+ dbContextOptionsBuilder.UseNpgsql(
+ connectionStringProvider.GetConnectionString(name),
+ sqlServerOptionsAction);
+ };
+ return builder;
+ }
+
+ public static MasaDbContextBuilder UsePgsql(
+ this MasaDbContextBuilder builder,
+ string connectionString,
+ Action? sqlServerOptionsAction = null)
+ => builder.UsePgCore(connectionString, sqlServerOptionsAction);
+
+ public static MasaDbContextBuilder UsePgsql(
+ this MasaDbContextBuilder builder,
+ DbConnection connection,
+ Action? sqlServerOptionsAction = null)
+ => builder.UsePgCore(connection, sqlServerOptionsAction);
+
+ private static MasaDbContextBuilder UsePgCore(
+ this MasaDbContextBuilder builder,
+ string connectionString,
+ Action? sqlServerOptionsAction)
+ {
+ builder.Builder = (_, dbContextOptionsBuilder)
+ => dbContextOptionsBuilder.UseNpgsql(connectionString, sqlServerOptionsAction);
+ return builder.ConfigMasaDbContextAndConnectionStringRelations(connectionString);
+ }
+
+ private static MasaDbContextBuilder UsePgCore(
+ this MasaDbContextBuilder builder,
+ DbConnection connection,
+ Action? sqlServerOptionsAction = null)
+ {
+ builder.Builder = (_, dbContextOptionsBuilder) => dbContextOptionsBuilder.UseNpgsql(connection, sqlServerOptionsAction);
+ return builder.ConfigMasaDbContextAndConnectionStringRelations(connection.ConnectionString);
+ }
+
+ internal static MasaDbContextBuilder ConfigMasaDbContextAndConnectionStringRelations(
+ this MasaDbContextBuilder builder,
+ string connectionString)
+ {
+ var name = ConnectionStringNameAttribute.GetConnStringName(builder.DbContextType);
+
+ builder.Services.Configure(connectionStrings =>
+ {
+ if (connectionStrings.ContainsKey(name) &&
+ connectionString != connectionStrings.GetConnectionString(name))
+ throw new ArgumentException($"The [{builder.DbContextType.Name}] Database Connection String already exists");
+
+ connectionStrings.TryAdd(name, connectionString);
+ });
+
+ return builder;
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Masa.Dcc.Infrastructure.EFCore.PostgreSql.csproj b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Masa.Dcc.Infrastructure.EFCore.PostgreSql.csproj
new file mode 100644
index 00000000..dacbdb2d
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Masa.Dcc.Infrastructure.EFCore.PostgreSql.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.Designer.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.Designer.cs
new file mode 100644
index 00000000..df66529f
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.Designer.cs
@@ -0,0 +1,583 @@
+//
+using System;
+using Masa.Dcc.Infrastructure.EFCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.Migrations
+{
+ [DbContext(typeof(DccDbContext))]
+ [Migration("20241206040332_dcc-init")]
+ partial class dccinit
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.29")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.AppConfigObject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AppId")
+ .HasColumnType("integer")
+ .HasComment("AppId");
+
+ b.Property("ConfigObjectId")
+ .HasColumnType("integer")
+ .HasComment("ConfigObjectId");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("EnvironmentClusterId")
+ .HasColumnType("integer")
+ .HasComment("EnvironmentClusterId");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ConfigObjectId")
+ .IsUnique();
+
+ b.ToTable("AppConfigObjects");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.AppPin", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AppId")
+ .HasColumnType("integer");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppPin");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.AppSecret", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AppId")
+ .HasColumnType("integer");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("EncryptionSecret")
+ .HasColumnType("uuid");
+
+ b.Property("EnvironmentId")
+ .HasColumnType("integer");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Secret")
+ .HasColumnType("uuid");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppSecrets");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfig", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("Identity")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("BizConfigs");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfigObject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BizConfigId")
+ .HasColumnType("integer");
+
+ b.Property("ConfigObjectId")
+ .HasColumnType("integer")
+ .HasComment("ConfigObjectId");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("EnvironmentClusterId")
+ .HasColumnType("integer")
+ .HasComment("EnvironmentClusterId");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BizConfigId");
+
+ b.HasIndex("ConfigObjectId")
+ .IsUnique();
+
+ b.ToTable("BizConfigObjects");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("Encryption")
+ .HasColumnType("boolean");
+
+ b.Property("FormatLabelCode")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)")
+ .HasComment("Format");
+
+ b.Property("FromRelation")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)")
+ .HasComment("Name");
+
+ b.Property("RelationConfigObjectId")
+ .HasColumnType("integer")
+ .HasComment("Relation config object Id");
+
+ b.Property("TempContent")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .HasColumnType("integer")
+ .HasComment("Type");
+
+ b.HasKey("Id");
+
+ b.ToTable("ConfigObjects");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObjectRelease", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Comment")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("varchar(1000)")
+ .HasComment("Comment");
+
+ b.Property("ConfigObjectId")
+ .HasColumnType("integer")
+ .HasComment("Config object Id");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasMaxLength(2147483647)
+ .HasColumnType("text")
+ .HasComment("Content");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("FromReleaseId")
+ .HasColumnType("integer")
+ .HasComment("Rollback From Release Id");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("IsInvalid")
+ .HasColumnType("boolean")
+ .HasComment("If it is rolled back, it will be true");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(200)")
+ .HasComment("Name");
+
+ b.Property("Type")
+ .HasColumnType("smallint")
+ .HasComment("Release type");
+
+ b.Property("Version")
+ .IsRequired()
+ .HasColumnType("varchar(20)")
+ .HasComment("Version format is yyyyMMddHHmmss");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ConfigObjectId");
+
+ b.ToTable("ConfigObjectReleases");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfig", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Identity")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("PublicConfigs");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfigObject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ConfigObjectId")
+ .HasColumnType("integer")
+ .HasComment("ConfigObjectId");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("EnvironmentClusterId")
+ .HasColumnType("integer")
+ .HasComment("EnvironmentClusterId");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("PublicConfigId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ConfigObjectId")
+ .IsUnique();
+
+ b.HasIndex("PublicConfigId");
+
+ b.ToTable("PublicConfigObjects");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.Label.Aggregates.Label", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)")
+ .HasComment("Code");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Creator")
+ .HasColumnType("uuid");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasComment("Description");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("ModificationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Modifier")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)")
+ .HasComment("Name");
+
+ b.Property("TypeCode")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasComment("TypeCode");
+
+ b.Property("TypeName")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasComment("TypeName");
+
+ b.HasKey("Id");
+
+ b.HasIndex(new[] { "TypeCode", "IsDeleted" }, "IX_TypeCode");
+
+ b.ToTable("Labels");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.AppConfigObject", b =>
+ {
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", "ConfigObject")
+ .WithOne("AppConfigObject")
+ .HasForeignKey("Masa.Dcc.Infrastructure.Domain.App.Aggregates.AppConfigObject", "ConfigObjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ConfigObject");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfigObject", b =>
+ {
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfig", "BizConfig")
+ .WithMany("BizConfigObjects")
+ .HasForeignKey("BizConfigId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", "ConfigObject")
+ .WithOne("BizConfigObject")
+ .HasForeignKey("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfigObject", "ConfigObjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("BizConfig");
+
+ b.Navigation("ConfigObject");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObjectRelease", b =>
+ {
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", null)
+ .WithMany("ConfigObjectRelease")
+ .HasForeignKey("ConfigObjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfigObject", b =>
+ {
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", "ConfigObject")
+ .WithOne("PublicConfigObject")
+ .HasForeignKey("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfigObject", "ConfigObjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfig", "PublicConfig")
+ .WithMany("PublicConfigObjects")
+ .HasForeignKey("PublicConfigId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ConfigObject");
+
+ b.Navigation("PublicConfig");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.BizConfig", b =>
+ {
+ b.Navigation("BizConfigObjects");
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.ConfigObject", b =>
+ {
+ b.Navigation("AppConfigObject")
+ .IsRequired();
+
+ b.Navigation("BizConfigObject")
+ .IsRequired();
+
+ b.Navigation("ConfigObjectRelease");
+
+ b.Navigation("PublicConfigObject")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Masa.Dcc.Infrastructure.Domain.App.Aggregates.PublicConfig", b =>
+ {
+ b.Navigation("PublicConfigObjects");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.cs b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.cs
new file mode 100644
index 00000000..5bb0b2cd
--- /dev/null
+++ b/Masa.Dcc.Infrastructure.EFCore.PostgreSql/Migrations/20241206040332_dcc-init.cs
@@ -0,0 +1,332 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace Masa.Dcc.Infrastructure.EFCore.PostgreSql.Migrations
+{
+ public partial class dccinit : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "AppPin",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ AppId = table.Column(type: "integer", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AppPin", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AppSecrets",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ AppId = table.Column(type: "integer", nullable: false),
+ EnvironmentId = table.Column(type: "integer", nullable: false),
+ Type = table.Column(type: "integer", nullable: false),
+ EncryptionSecret = table.Column(type: "uuid", nullable: false),
+ Secret = table.Column(type: "uuid", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AppSecrets", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "BizConfigs",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ Identity = table.Column(type: "text", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_BizConfigs", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ConfigObjects",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "Name"),
+ FormatLabelCode = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "Format"),
+ Type = table.Column(type: "integer", nullable: false, comment: "Type"),
+ Encryption = table.Column(type: "boolean", nullable: false),
+ Content = table.Column(type: "text", nullable: false),
+ TempContent = table.Column(type: "text", nullable: false),
+ RelationConfigObjectId = table.Column(type: "integer", nullable: false, comment: "Relation config object Id"),
+ FromRelation = table.Column(type: "boolean", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ConfigObjects", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Labels",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Code = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "Code"),
+ Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "Name"),
+ TypeCode = table.Column(type: "character varying(255)", maxLength: 255, nullable: false, comment: "TypeCode"),
+ TypeName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false, comment: "TypeName"),
+ Description = table.Column(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Description"),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Labels", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "PublicConfigs",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ Identity = table.Column(type: "text", nullable: false),
+ Description = table.Column(type: "text", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_PublicConfigs", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AppConfigObjects",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ AppId = table.Column(type: "integer", nullable: false, comment: "AppId"),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ ConfigObjectId = table.Column(type: "integer", nullable: false, comment: "ConfigObjectId"),
+ EnvironmentClusterId = table.Column(type: "integer", nullable: false, comment: "EnvironmentClusterId")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AppConfigObjects", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AppConfigObjects_ConfigObjects_ConfigObjectId",
+ column: x => x.ConfigObjectId,
+ principalTable: "ConfigObjects",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "BizConfigObjects",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ BizConfigId = table.Column(type: "integer", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ ConfigObjectId = table.Column(type: "integer", nullable: false, comment: "ConfigObjectId"),
+ EnvironmentClusterId = table.Column(type: "integer", nullable: false, comment: "EnvironmentClusterId")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_BizConfigObjects", x => x.Id);
+ table.ForeignKey(
+ name: "FK_BizConfigObjects_BizConfigs_BizConfigId",
+ column: x => x.BizConfigId,
+ principalTable: "BizConfigs",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_BizConfigObjects_ConfigObjects_ConfigObjectId",
+ column: x => x.ConfigObjectId,
+ principalTable: "ConfigObjects",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ConfigObjectReleases",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Type = table.Column(type: "smallint", nullable: false, comment: "Release type"),
+ ConfigObjectId = table.Column(type: "integer", nullable: false, comment: "Config object Id"),
+ FromReleaseId = table.Column(type: "integer", nullable: false, comment: "Rollback From Release Id"),
+ IsInvalid = table.Column(type: "boolean", nullable: false, comment: "If it is rolled back, it will be true"),
+ Version = table.Column(type: "varchar(20)", nullable: false, comment: "Version format is yyyyMMddHHmmss"),
+ Name = table.Column(type: "varchar(200)", maxLength: 100, nullable: false, comment: "Name"),
+ Comment = table.Column(type: "varchar(1000)", maxLength: 500, nullable: false, comment: "Comment"),
+ Content = table.Column(type: "text", maxLength: 2147483647, nullable: false, comment: "Content"),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ConfigObjectReleases", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ConfigObjectReleases_ConfigObjects_ConfigObjectId",
+ column: x => x.ConfigObjectId,
+ principalTable: "ConfigObjects",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "PublicConfigObjects",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ PublicConfigId = table.Column(type: "integer", nullable: false),
+ Creator = table.Column(type: "uuid", nullable: false),
+ CreationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Modifier = table.Column(type: "uuid", nullable: false),
+ ModificationTime = table.Column(type: "timestamp with time zone", nullable: false),
+ IsDeleted = table.Column(type: "boolean", nullable: false),
+ ConfigObjectId = table.Column