Compare commits
12 Commits
408b1e9f0d
...
be51ca31dd
| Author | SHA1 | Date | |
|---|---|---|---|
| be51ca31dd | |||
| bb8d7cd208 | |||
| b6588db615 | |||
| 9a9aa2608b | |||
| 349d65d050 | |||
| 93593226e2 | |||
| 351cead423 | |||
| 07cab88e0d | |||
| faa019355a | |||
| df9bcf3221 | |||
| cda19e2b83 | |||
| 1586009a72 |
@@ -3,6 +3,6 @@
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DbTriggerParams : Dictionary<string, IEnumerable<string>>
|
||||
public class DbTriggerParams : Dictionary<string, ICollection<string>>
|
||||
{
|
||||
}
|
||||
@@ -38,7 +38,6 @@ public static class DependencyInjection
|
||||
services.TryAddScoped<IEnvelopeReceiverService, EnvelopeReceiverService>();
|
||||
services.TryAddScoped<IEnvelopeTypeService, EnvelopeTypeService>();
|
||||
services.TryAddScoped<IReceiverService, ReceiverService>();
|
||||
services.TryAddScoped<IUserReceiverService, UserReceiverService>();
|
||||
services.TryAddScoped<IEnvelopeReceiverReadOnlyService, EnvelopeReceiverReadOnlyService>();
|
||||
|
||||
//Auto mapping profiles
|
||||
|
||||
@@ -74,4 +74,9 @@ public static class Key
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string Default = nameof(Default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly string DbMigrationTest = nameof(DbMigrationTest);
|
||||
}
|
||||
@@ -38,10 +38,8 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
[Column("COMMENT", TypeName = "nvarchar(max)")]
|
||||
public string Comment { get; set; }
|
||||
|
||||
[ForeignKey("UserReference")]
|
||||
public virtual User Sender { get; set; }
|
||||
|
||||
[ForeignKey("UserReference")]
|
||||
public virtual Receiver Receiver { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
[NotMapped]
|
||||
public Envelope Envelope { get; set; }
|
||||
|
||||
[Column("RECEIVER_MAIL")]
|
||||
[Column("RECEIVER_MAIL", TypeName = "nvarchar(250)")]
|
||||
[Required]
|
||||
[StringLength(250)]
|
||||
[TemplatePlaceholder("NAME_RECEIVER")]
|
||||
@@ -33,9 +33,9 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
[Required]
|
||||
public DateTime DateValid { get; set; }
|
||||
|
||||
[Column("ADDED_WHO")]
|
||||
[Column("ADDED_WHO", TypeName = "nvarchar(250)")]
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
[StringLength(250)]
|
||||
public string AddedWho { get; set; }
|
||||
|
||||
public Receiver Receiver { get; set; }
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required, EmailAddress]
|
||||
[Column("EMAIL_ADDRESS", TypeName = "nvarchar(128)")]
|
||||
[Column("EMAIL_ADDRESS", TypeName = "nvarchar(250)")]
|
||||
[StringLength(250)]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
[Required]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<PackageReference Include="DigitalData.Auth.Client" Version="1.3.7" />
|
||||
<PackageReference Include="DigitalData.Core.API" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
|
||||
<PackageReference Include="NLog" Version="5.2.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.0" />
|
||||
<PackageReference Include="Scalar.AspNetCore" Version="2.2.1" />
|
||||
|
||||
@@ -40,7 +40,7 @@ try
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
//CORS Policy
|
||||
// CORS Policy
|
||||
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
||||
throw new InvalidOperationException("AllowedOrigins section is missing in the configuration.");
|
||||
builder.Services.AddCors(options =>
|
||||
@@ -104,8 +104,12 @@ try
|
||||
}
|
||||
});
|
||||
builder.Services.AddOpenApi();
|
||||
// DbContext
|
||||
var connStr = config.GetConnectionString("Default") ?? throw new InvalidOperationException("There is no default connection string in appsettings.json.");
|
||||
|
||||
//AddEF Core dbcontext
|
||||
var useDbMigration = Environment.GetEnvironmentVariable("MIGRATION_TEST_MODE") == true.ToString() || config.GetValue<bool>("UseDbMigration");
|
||||
var cnnStrName = useDbMigration ? "DbMigrationTest" : "Default";
|
||||
var connStr = config.GetConnectionString(cnnStrName)
|
||||
?? throw new InvalidOperationException($"Connection string '{cnnStrName}' is missing in the application configuration.");
|
||||
|
||||
builder.Services.Configure<ConnectionString>(cs => cs.Value = connStr);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"UseSwagger": true,
|
||||
"UseDbMigration": true,
|
||||
"DiPMode": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
@@ -10,7 +11,8 @@
|
||||
"AllowedHosts": "*",
|
||||
"AllowedOrigins": [ "http://localhost:4200" ],
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||
"DbMigrationTest": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM_DATA_MIGR_TEST;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"DirectorySearchOptions": {
|
||||
"ServerName": "DD-VMP01-DC01",
|
||||
|
||||
@@ -59,9 +59,11 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
|
||||
private readonly DbTriggerParams _triggers;
|
||||
|
||||
private readonly ILogger<EGDbContext> _logger;
|
||||
private readonly ILogger<EGDbContext>? _logger;
|
||||
|
||||
public EGDbContext(DbContextOptions<EGDbContext> options, IOptions<DbTriggerParams> triggerParamOptions, ILogger<EGDbContext> logger) : base(options)
|
||||
public bool IsMigration { get; set; } = false;
|
||||
|
||||
public EGDbContext(DbContextOptions<EGDbContext> options, IOptions<DbTriggerParams> triggerParamOptions, ILogger<EGDbContext>? logger = null) : base(options)
|
||||
{
|
||||
_triggers = triggerParamOptions.Value;
|
||||
_logger = logger;
|
||||
@@ -126,17 +128,20 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
.WithMany(ed => ed.Elements)
|
||||
.HasForeignKey(dre => dre.DocumentId);
|
||||
|
||||
modelBuilder.Entity<EnvelopeHistory>()
|
||||
.HasOne(eh => eh.Receiver)
|
||||
.WithMany()
|
||||
.HasForeignKey(eh => eh.UserReference)
|
||||
.HasPrincipalKey(e => e.EmailAddress);
|
||||
if (!IsMigration)
|
||||
{
|
||||
modelBuilder.Entity<EnvelopeHistory>()
|
||||
.HasOne(eh => eh.Receiver)
|
||||
.WithMany()
|
||||
.HasForeignKey(eh => eh.UserReference)
|
||||
.HasPrincipalKey(e => e.EmailAddress);
|
||||
|
||||
modelBuilder.Entity<EnvelopeHistory>()
|
||||
.HasOne(eh => eh.Sender)
|
||||
.WithMany()
|
||||
.HasForeignKey(eh => eh.UserReference)
|
||||
.HasPrincipalKey(e => e.Email);
|
||||
modelBuilder.Entity<EnvelopeHistory>()
|
||||
.HasOne(eh => eh.Sender)
|
||||
.WithMany()
|
||||
.HasForeignKey(eh => eh.UserReference)
|
||||
.HasPrincipalKey(e => e.Email);
|
||||
}
|
||||
|
||||
modelBuilder.Entity<EnvelopeReceiverReadOnly>()
|
||||
.HasOne(erro => erro.Receiver)
|
||||
@@ -151,7 +156,7 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
|
||||
.ForEach(tName =>
|
||||
{
|
||||
modelBuilder.Entity<T>().ToTable(tb => tb.HasTrigger(tName));
|
||||
_logger.LogInformation("Trigger '{triggerName}' has been added to the '{entityName}' entity.", tName, typeof(T).Name);
|
||||
_logger?.LogInformation("Trigger '{triggerName}' has been added to the '{entityName}' entity.", tName, typeof(T).Name);
|
||||
});
|
||||
|
||||
// TODO: call add trigger methods with attributes and reflection
|
||||
|
||||
46
EnvelopeGenerator.Infrastructure/EGDbContextFactory.cs
Normal file
46
EnvelopeGenerator.Infrastructure/EGDbContextFactory.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using EnvelopeGenerator.Application.Configurations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure
|
||||
{
|
||||
public class EGDbContextFactory : IDesignTimeDbContextFactory<EGDbContext>
|
||||
{
|
||||
public EGDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var config = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory()) // Önemli!
|
||||
.AddJsonFile("appsettings.migration.json")
|
||||
.Build();
|
||||
|
||||
// create DbContextOptions
|
||||
var optionsBuilder = new DbContextOptionsBuilder<EGDbContext>();
|
||||
optionsBuilder.UseSqlServer(config.GetConnectionString("Default"));
|
||||
|
||||
// create DbTriggerParams
|
||||
var triggerLists = config.GetSection("DbTriggerParams").Get<Dictionary<string, List<string>>>();
|
||||
var dbTriggerParams = new DbTriggerParams();
|
||||
if(triggerLists is not null)
|
||||
foreach (var triggerList in triggerLists)
|
||||
{
|
||||
if(triggerList.Value.Count == 0)
|
||||
continue; // Skip empty trigger lists
|
||||
|
||||
var tableName = triggerList.Key;
|
||||
|
||||
dbTriggerParams[tableName] = new List<string>();
|
||||
|
||||
foreach (var trigger in triggerList.Value)
|
||||
{
|
||||
dbTriggerParams[tableName].Add(trigger);
|
||||
}
|
||||
}
|
||||
|
||||
var dbContext = new EGDbContext(optionsBuilder.Options, Options.Create(dbTriggerParams));
|
||||
dbContext.IsMigration = true;
|
||||
return dbContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,16 +23,37 @@
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.20">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.20" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.17">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.17" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.migration.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
1380
EnvelopeGenerator.Infrastructure/Migrations/20250701151754_InitialCreate.Designer.cs
generated
Normal file
1380
EnvelopeGenerator.Infrastructure/Migrations/20250701151754_InitialCreate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,811 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "dbo");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_CLIENT_USER",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
USER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
CLIENT_ID = table.Column<int>(type: "int", nullable: false),
|
||||
COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_CLIENT_USER", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_GROUPS",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AD_SYNC = table.Column<bool>(type: "bit", nullable: false),
|
||||
Internal = table.Column<bool>(type: "bit", nullable: false),
|
||||
Active = table.Column<bool>(type: "bit", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
||||
ECM_FK_ID = table.Column<int>(type: "int", nullable: false),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_GROUPS", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_MODULES",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
SHORT_NAME = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_MODULES", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_USER",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PRENAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
NAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
USERNAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
SHORTNAME = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
|
||||
EMAIL = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
LANGUAGE = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false),
|
||||
COMMENT = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
||||
DELETED = table.Column<bool>(type: "bit", nullable: false),
|
||||
DATE_FORMAT = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
|
||||
ACTIVE = table.Column<bool>(type: "bit", nullable: false),
|
||||
GENERAL_VIEWER = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
|
||||
WAN_ENVIRONMENT = table.Column<bool>(type: "bit", nullable: false),
|
||||
USERID_FK_INT_ECM = table.Column<int>(type: "int", nullable: false),
|
||||
DELETED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DELETED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_USER", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBEMLP_EMAIL_OUT",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
REMINDER_TYPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
SENDING_PROFILE = table.Column<int>(type: "int", nullable: false),
|
||||
REFERENCE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
REFERENCE_STRING = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true),
|
||||
ENTITY_ID = table.Column<int>(type: "int", nullable: true),
|
||||
WF_ID = table.Column<int>(type: "int", nullable: false),
|
||||
WF_REFERENCE = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true),
|
||||
EMAIL_ADRESS = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false),
|
||||
EMAIL_SUBJ = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false),
|
||||
EMAIL_BODY = table.Column<string>(type: "varchar(max)", nullable: false),
|
||||
EMAIL_ATTMT1 = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true),
|
||||
EMAIL_SENT = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
COMMENT = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true),
|
||||
ADDED_WHO = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false),
|
||||
CHANGED_WHO = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ERROR_TIMESTAMP = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ERROR_MSG = table.Column<string>(type: "varchar(900)", maxLength: 900, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBEMLP_EMAIL_OUT", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_CONFIG",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
SENDING_PROFILE = table.Column<int>(type: "int", nullable: false),
|
||||
SIGNATURE_HOST = table.Column<string>(type: "nvarchar(128)", nullable: false),
|
||||
EXTERNAL_PROGRAM_NAME = table.Column<string>(type: "nvarchar(30)", nullable: true),
|
||||
EXPORT_PATH = table.Column<string>(type: "nvarchar(256)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_EMAIL_TEMPLATE",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
NAME = table.Column<string>(type: "nvarchar(64)", nullable: true),
|
||||
BODY = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SUBJECT = table.Column<string>(type: "nvarchar(512)", nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_EMAIL_TEMPLATE", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_CERTIFICATE",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
ENVELOPE_UUID = table.Column<string>(type: "nvarchar(36)", nullable: false),
|
||||
ENVELOPE_SUBJECT = table.Column<string>(type: "nvarchar(512)", nullable: false),
|
||||
CREATOR_ID = table.Column<int>(type: "int", nullable: false),
|
||||
CREATOR_NAME = table.Column<string>(type: "nvarchar(128)", nullable: false),
|
||||
CREATOR_EMAIL = table.Column<string>(type: "nvarchar(128)", nullable: false),
|
||||
ENVELOPE_STATUS = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_CERTIFICATE", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_TYPE",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TITLE = table.Column<string>(type: "nvarchar(128)", nullable: false),
|
||||
LANGUAGE = table.Column<string>(type: "nvarchar(5)", nullable: true),
|
||||
EXPIRES_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
CERTIFICATION_TYPE = table.Column<int>(type: "int", nullable: false),
|
||||
USE_ACCESS_CODE = table.Column<bool>(type: "bit", nullable: false),
|
||||
FINAL_EMAIL_TO_CREATOR = table.Column<int>(type: "int", nullable: false),
|
||||
FINAL_EMAIL_TO_RECEIVERS = table.Column<int>(type: "int", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
EXPIRES_WARNING_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
SEND_REMINDER_EMAILS = table.Column<bool>(type: "bit", nullable: false),
|
||||
FIRST_REMINDER_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
REMINDER_INTERVAL_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
CONTRACT_TYPE = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_TYPE", x => x.GUID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_GROUPS_USER",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
USER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
GROUP_ID = table.Column<int>(type: "int", nullable: false),
|
||||
Comment = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_GROUPS_USER", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_GROUPS_USER_TBDD_GROUPS_GROUP_ID",
|
||||
column: x => x.GROUP_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_GROUPS",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_GROUPS_USER_TBDD_USER_USER_ID",
|
||||
column: x => x.USER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_USER_MODULES",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
USER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
MODULE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
COMMENT = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_USER_MODULES", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_MODULES_TBDD_MODULES_MODULE_ID",
|
||||
column: x => x.MODULE_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_MODULES",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_MODULES_TBDD_USER_USER_ID",
|
||||
column: x => x.USER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBDD_USER_REPRESENTATION",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
USER_ID = table.Column<int>(type: "int", nullable: true),
|
||||
REPR_GROUP = table.Column<int>(type: "int", nullable: true),
|
||||
GROUP_ID = table.Column<int>(type: "int", nullable: true),
|
||||
REPR_USER = table.Column<int>(type: "int", nullable: true),
|
||||
VALID_FROM = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
VALID_TO = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBDD_USER_REPRESENTATION", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_REPRESENTATION_TBDD_GROUPS_GROUP_ID",
|
||||
column: x => x.GROUP_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_GROUPS",
|
||||
principalColumn: "GUID");
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_REPRESENTATION_TBDD_GROUPS_REPR_GROUP",
|
||||
column: x => x.REPR_GROUP,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_GROUPS",
|
||||
principalColumn: "GUID");
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_REPRESENTATION_TBDD_USER_REPR_USER",
|
||||
column: x => x.REPR_USER,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID");
|
||||
table.ForeignKey(
|
||||
name: "FK_TBDD_USER_REPRESENTATION_TBDD_USER_USER_ID",
|
||||
column: x => x.USER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
USER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
STATUS = table.Column<int>(type: "int", nullable: false),
|
||||
ENVELOPE_UUID = table.Column<string>(type: "nvarchar(36)", nullable: false),
|
||||
MESSAGE = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
EXPIRES_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
EXPIRES_WARNING_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
TITLE = table.Column<string>(type: "nvarchar(128)", nullable: true),
|
||||
CONTRACT_TYPE = table.Column<int>(type: "int", nullable: false),
|
||||
LANGUAGE = table.Column<string>(type: "nvarchar(5)", nullable: true),
|
||||
SEND_REMINDER_EMAILS = table.Column<bool>(type: "bit", nullable: false),
|
||||
FIRST_REMINDER_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
REMINDER_INTERVAL_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
ENVELOPE_TYPE = table.Column<int>(type: "int", nullable: false),
|
||||
CERTIFICATION_TYPE = table.Column<int>(type: "int", nullable: false),
|
||||
USE_ACCESS_CODE = table.Column<bool>(type: "bit", nullable: false),
|
||||
FINAL_EMAIL_TO_CREATOR = table.Column<int>(type: "int", nullable: false),
|
||||
FINAL_EMAIL_TO_RECEIVERS = table.Column<int>(type: "int", nullable: false),
|
||||
EXPIRES_WHEN_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
EXPIRES_WARNING_WHEN_DAYS = table.Column<int>(type: "int", nullable: false),
|
||||
TFA_ENABLED = table.Column<bool>(type: "bit", nullable: false),
|
||||
DOC_RESULT = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_TBDD_USER_USER_ID",
|
||||
column: x => x.USER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_TBSIG_ENVELOPE_TYPE_ENVELOPE_TYPE",
|
||||
column: x => x.ENVELOPE_TYPE,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE_TYPE",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_DOCUMENT",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
BYTE_DATA = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_DOCUMENT", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_DOCUMENT_TBSIG_ENVELOPE_ENVELOPE_ID",
|
||||
column: x => x.ENVELOPE_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_RECEIVER",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EMAIL_ADDRESS = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
|
||||
SIGNATURE = table.Column<string>(type: "nvarchar(64)", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
TOTP_SECRET_KEY = table.Column<string>(type: "nvarchar(MAX)", nullable: true),
|
||||
TFA_REG_DEADLINE = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
EnvelopeId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_RECEIVER", x => x.GUID);
|
||||
table.UniqueConstraint("AK_TBSIG_RECEIVER_EMAIL_ADDRESS", x => x.EMAIL_ADDRESS);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_RECEIVER_TBSIG_ENVELOPE_EnvelopeId",
|
||||
column: x => x.EnvelopeId,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE",
|
||||
principalColumn: "GUID");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DOCUMENT_ID = table.Column<int>(type: "int", nullable: false),
|
||||
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
ELEMENT_TYPE = table.Column<int>(type: "int", nullable: false),
|
||||
POSITION_X = table.Column<double>(type: "float", nullable: false),
|
||||
POSITION_Y = table.Column<double>(type: "float", nullable: false),
|
||||
WIDTH = table.Column<double>(type: "float", nullable: false),
|
||||
HEIGHT = table.Column<double>(type: "float", nullable: false),
|
||||
PAGE = table.Column<int>(type: "int", nullable: false),
|
||||
REQUIRED = table.Column<bool>(type: "bit", nullable: false),
|
||||
TOOLTIP = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
READ_ONLY = table.Column<bool>(type: "bit", nullable: false),
|
||||
ANNOTATION_INDEX = table.Column<int>(type: "int", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_DOCUMENT_RECEIVER_ELEMENT", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_DOCUMENT_RECEIVER_ELEMENT_TBSIG_ENVELOPE_DOCUMENT_DOCUMENT_ID",
|
||||
column: x => x.DOCUMENT_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE_DOCUMENT",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_DOCUMENT_RECEIVER_ELEMENT_TBSIG_RECEIVER_RECEIVER_ID",
|
||||
column: x => x.RECEIVER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_RECEIVER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_DOCUMENT_STATUS",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
STATUS = table.Column<int>(type: "int", nullable: false),
|
||||
STATUS_CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
VALUE = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_DOCUMENT_STATUS", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_DOCUMENT_STATUS_TBSIG_ENVELOPE_ENVELOPE_ID",
|
||||
column: x => x.ENVELOPE_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_DOCUMENT_STATUS_TBSIG_RECEIVER_RECEIVER_ID",
|
||||
column: x => x.RECEIVER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_RECEIVER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_HISTORY",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
USER_REFERENCE = table.Column<string>(type: "nvarchar(128)", nullable: false),
|
||||
STATUS = table.Column<int>(type: "int", nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
ACTION_DATE = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
COMMENT = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
SenderId = table.Column<int>(type: "int", nullable: true),
|
||||
ReceiverId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_HISTORY", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_HISTORY_TBDD_USER_SenderId",
|
||||
column: x => x.SenderId,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBDD_USER",
|
||||
principalColumn: "GUID");
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_HISTORY_TBSIG_ENVELOPE_ENVELOPE_ID",
|
||||
column: x => x.ENVELOPE_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_HISTORY_TBSIG_RECEIVER_ReceiverId",
|
||||
column: x => x.ReceiverId,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_RECEIVER",
|
||||
principalColumn: "GUID");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_RECEIVER",
|
||||
schema: "dbo",
|
||||
columns: table => new
|
||||
{
|
||||
ENVELOPE_ID = table.Column<int>(type: "int", nullable: false),
|
||||
RECEIVER_ID = table.Column<int>(type: "int", nullable: false),
|
||||
SEQUENCE = table.Column<int>(type: "int", nullable: false),
|
||||
NAME = table.Column<string>(type: "nvarchar(128)", nullable: true),
|
||||
JOB_TITLE = table.Column<string>(type: "nvarchar(128)", nullable: true),
|
||||
COMPANY_NAME = table.Column<string>(type: "nvarchar(128)", nullable: true),
|
||||
PRIVATE_MESSAGE = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ACCESS_CODE = table.Column<string>(type: "nvarchar(64)", nullable: true),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime", nullable: false),
|
||||
PHONE_NUMBER = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_RECEIVER", x => new { x.ENVELOPE_ID, x.RECEIVER_ID });
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_RECEIVER_TBSIG_ENVELOPE_ENVELOPE_ID",
|
||||
column: x => x.ENVELOPE_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_ENVELOPE",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_RECEIVER_TBSIG_RECEIVER_RECEIVER_ID",
|
||||
column: x => x.RECEIVER_ID,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_RECEIVER",
|
||||
principalColumn: "GUID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY",
|
||||
columns: table => new
|
||||
{
|
||||
GUID = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ENVELOPE_ID = table.Column<long>(type: "bigint", nullable: false),
|
||||
RECEIVER_MAIL = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
|
||||
DATE_VALID = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ADDED_WHO = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
|
||||
ADDED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CHANGED_WHO = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
CHANGED_WHEN = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TBSIG_ENVELOPE_RECEIVER_READ_ONLY", x => x.GUID);
|
||||
table.ForeignKey(
|
||||
name: "FK_TBSIG_ENVELOPE_RECEIVER_READ_ONLY_TBSIG_RECEIVER_ADDED_WHO",
|
||||
column: x => x.ADDED_WHO,
|
||||
principalSchema: "dbo",
|
||||
principalTable: "TBSIG_RECEIVER",
|
||||
principalColumn: "EMAIL_ADDRESS",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_GROUPS_USER_GROUP_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_GROUPS_USER",
|
||||
column: "GROUP_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_GROUPS_USER_USER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_GROUPS_USER",
|
||||
column: "USER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_MODULES_MODULE_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_MODULES",
|
||||
column: "MODULE_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_MODULES_USER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_MODULES",
|
||||
column: "USER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_REPRESENTATION_GROUP_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_REPRESENTATION",
|
||||
column: "GROUP_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_REPRESENTATION_REPR_GROUP",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_REPRESENTATION",
|
||||
column: "REPR_GROUP");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_REPRESENTATION_REPR_USER",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_REPRESENTATION",
|
||||
column: "REPR_USER");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBDD_USER_REPRESENTATION_USER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBDD_USER_REPRESENTATION",
|
||||
column: "USER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_DOCUMENT_RECEIVER_ELEMENT_DOCUMENT_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
|
||||
column: "DOCUMENT_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_DOCUMENT_RECEIVER_ELEMENT_RECEIVER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
|
||||
column: "RECEIVER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_DOCUMENT_STATUS_ENVELOPE_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_DOCUMENT_STATUS",
|
||||
column: "ENVELOPE_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_DOCUMENT_STATUS_RECEIVER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_DOCUMENT_STATUS",
|
||||
column: "RECEIVER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_ENVELOPE_TYPE",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE",
|
||||
column: "ENVELOPE_TYPE");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_USER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE",
|
||||
column: "USER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_DOCUMENT_ENVELOPE_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE_DOCUMENT",
|
||||
column: "ENVELOPE_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_HISTORY_ENVELOPE_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE_HISTORY",
|
||||
column: "ENVELOPE_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_HISTORY_ReceiverId",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE_HISTORY",
|
||||
column: "ReceiverId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_HISTORY_SenderId",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE_HISTORY",
|
||||
column: "SenderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_RECEIVER_RECEIVER_ID",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_ENVELOPE_RECEIVER",
|
||||
column: "RECEIVER_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_ENVELOPE_RECEIVER_READ_ONLY_ADDED_WHO",
|
||||
table: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY",
|
||||
column: "ADDED_WHO");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TBSIG_RECEIVER_EnvelopeId",
|
||||
schema: "dbo",
|
||||
table: "TBSIG_RECEIVER",
|
||||
column: "EnvelopeId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_CLIENT_USER",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_GROUPS_USER",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_USER_MODULES",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_USER_REPRESENTATION",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBEMLP_EMAIL_OUT");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_CONFIG",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_DOCUMENT_RECEIVER_ELEMENT",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_DOCUMENT_STATUS",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_EMAIL_TEMPLATE",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_CERTIFICATE",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_HISTORY",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_RECEIVER",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_RECEIVER_READ_ONLY");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_MODULES",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_GROUPS",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_DOCUMENT",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_RECEIVER",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBDD_USER",
|
||||
schema: "dbo");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TBSIG_ENVELOPE_TYPE",
|
||||
schema: "dbo");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
13
EnvelopeGenerator.Infrastructure/appsettings.migration.json
Normal file
13
EnvelopeGenerator.Infrastructure/appsettings.migration.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM_DATA_MIGR_TEST;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"DbTriggerParams": {
|
||||
"Envelope": [ "TBSIG_ENVELOPE_HISTORY_AFT_INS" ],
|
||||
"EnvelopeHistory": [ "TBSIG_ENVELOPE_HISTORY_AFT_INS" ],
|
||||
"EmailOut": [ "TBEMLP_EMAIL_OUT_AFT_INS", "TBEMLP_EMAIL_OUT_AFT_UPD" ],
|
||||
"EnvelopeReceiverReadOnly": [ "TBSIG_ENVELOPE_RECEIVER_READ_ONLY_UPD" ],
|
||||
"Receiver": [],
|
||||
"EmailTemplate": [ "TBSIG_EMAIL_TEMPLATE_AFT_UPD" ]
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,8 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||
"Dev": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM_DATA_MIGR_TEST;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"PSPDFKitLicenseKey": "SXCtGGY9XA-31OGUXQK-r7c6AkdLGPm2ljuyDr1qu0kkhLvydg-Do-fxpNUF4Rq3fS_xAnZRNFRHbXpE6sQ2BMcCSVTcXVJO6tPviexjpiT-HnrDEySlUERJnnvh-tmeOWprxS6BySPnSILkmaVQtUfOIUS-cUbvvEYHTvQBKbSF8di4XHQFyfv49ihr51axm3NVV3AXwh2EiKL5C5XdqBZ4sQ4O7vXBjM2zvxdPxlxdcNYmiU83uAzw7B83O_jubPzya4CdUHh_YH7Nlp2gP56MeG1Sw2JhMtfG3Rj14Sg4ctaeL9p6AEWca5dDjJ2li5tFIV2fQSsw6A_cowLu0gtMm5i8IfJXeIcQbMC2-0wGv1oe9hZYJvFMdzhTM_FiejM0agemxt3lJyzuyP8zbBSOgp7Si6A85krLWPZptyZBTG7pp7IHboUHfPMxCXqi-zMsqewOJtQBE2mjntU-lPryKnssOpMPfswwQX7QSkJYV5EMqNmEhQX6mEkp2wcqFzMC7bJQew1aO4pOpvChUaMvb1vgRek0HxLag0nwQYX2YrYGh7F_xXJs-8HNwJe8H0-eW4x4faayCgM5rB5772CCCsD9ThZcvXFrjNHHLGJ8WuBUFm6LArvSfFQdii_7j-_sqHMpeKZt26NFgivj1A==",
|
||||
"Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value.
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Mock
|
||||
builder.Configuration.AddJsonFile(configPath, optional: true, reloadOnChange: true);
|
||||
|
||||
builder.Services
|
||||
.AddEnvelopeGeneratorInfrastructureServices(opt =>
|
||||
.AddEnvelopeGeneratorInfrastructureServices((provider, opt) =>
|
||||
{
|
||||
if (useRealDb)
|
||||
{
|
||||
|
||||
@@ -2113,7 +2113,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="7.0.20" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.2.5" />
|
||||
|
||||
@@ -88,7 +88,10 @@ try
|
||||
}
|
||||
|
||||
//AddEF Core dbcontext
|
||||
var connStr = config.GetConnectionString(Key.Default) ?? throw new InvalidOperationException("There is no default connection string in appsettings.json.");
|
||||
var useDbMigration = Environment.GetEnvironmentVariable("MIGRATION_TEST_MODE") == true.ToString() || config.GetValue<bool>("UseDbMigration");
|
||||
var cnnStrName = useDbMigration ? Key.DbMigrationTest : Key.Default;
|
||||
var connStr = config.GetConnectionString(cnnStrName)
|
||||
?? throw new InvalidOperationException($"Connection string '{cnnStrName}' is missing in the application configuration.");
|
||||
|
||||
builder.Services.AddDistributedSqlServerCache(options =>
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"swagger": {
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
@@ -25,6 +25,17 @@
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7202;http://localhost:5009"
|
||||
},
|
||||
"httpsDbMigration": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"MIGRATION_TEST_MODE": "true"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7202;http://localhost:5009"
|
||||
}
|
||||
},
|
||||
"iisSettings": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"DiPMode": false, //Please be careful when enabling Development in Production (DiP) mode. It allows Swagger and test controllers to be enabled in a production environment.
|
||||
"EnableSwagger": true,
|
||||
"UseDbMigration": false,
|
||||
"EnableTestControllers": true,
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
@@ -12,7 +13,8 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||
"DbMigrationTest": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM_DATA_MIGR_TEST;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"PSPDFKitLicenseKey": "SXCtGGY9XA-31OGUXQK-r7c6AkdLGPm2ljuyDr1qu0kkhLvydg-Do-fxpNUF4Rq3fS_xAnZRNFRHbXpE6sQ2BMcCSVTcXVJO6tPviexjpiT-HnrDEySlUERJnnvh-tmeOWprxS6BySPnSILkmaVQtUfOIUS-cUbvvEYHTvQBKbSF8di4XHQFyfv49ihr51axm3NVV3AXwh2EiKL5C5XdqBZ4sQ4O7vXBjM2zvxdPxlxdcNYmiU83uAzw7B83O_jubPzya4CdUHh_YH7Nlp2gP56MeG1Sw2JhMtfG3Rj14Sg4ctaeL9p6AEWca5dDjJ2li5tFIV2fQSsw6A_cowLu0gtMm5i8IfJXeIcQbMC2-0wGv1oe9hZYJvFMdzhTM_FiejM0agemxt3lJyzuyP8zbBSOgp7Si6A85krLWPZptyZBTG7pp7IHboUHfPMxCXqi-zMsqewOJtQBE2mjntU-lPryKnssOpMPfswwQX7QSkJYV5EMqNmEhQX6mEkp2wcqFzMC7bJQew1aO4pOpvChUaMvb1vgRek0HxLag0nwQYX2YrYGh7F_xXJs-8HNwJe8H0-eW4x4faayCgM5rB5772CCCsD9ThZcvXFrjNHHLGJ8WuBUFm6LArvSfFQdii_7j-_sqHMpeKZt26NFgivj1A==",
|
||||
"Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value.
|
||||
|
||||
Reference in New Issue
Block a user