添加数据库迁移
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using Domain.AggregateModel.AppAggregate;
|
||||
using Domain.AggregateModel.LinkAggregate;
|
||||
using Domain.SeedWork;
|
||||
using Infrastructure.EntityConfigurations;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -34,13 +36,8 @@ namespace Infrastructure
|
||||
}
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
//modelBuilder.ApplyConfiguration(new ClientRequestEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new PaymentMethodEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new OrderEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new OrderItemEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new CardTypeEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new OrderStatusEntityTypeConfiguration());
|
||||
//modelBuilder.ApplyConfiguration(new BuyerEntityTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new AppEntityTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new LinkEntityTypeConfiguration());
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +111,16 @@ namespace Infrastructure
|
||||
public AppDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>()
|
||||
.UseMySql("Server=localhost;Database=qrcode;Uid=root;Pwd=root;");
|
||||
.UseMySql(
|
||||
"server=localhost;user=root;password=root;database=qrcode",
|
||||
// For common usages, see pull request #1233.
|
||||
new MariaDbServerVersion(new Version(10, 5, 9)), // use MariaDbServerVersion for MariaDB
|
||||
mySqlOptions => mySqlOptions
|
||||
.CharSetBehavior(CharSetBehavior.NeverAppend)
|
||||
.MigrationsAssembly("QRCodeService"))
|
||||
// Everything from this point on is optional but helps with debugging.
|
||||
.EnableSensitiveDataLogging()
|
||||
.EnableDetailedErrors();
|
||||
|
||||
return new AppDbContext(optionsBuilder.Options, new NoMediator());
|
||||
}
|
||||
|
||||
@@ -14,9 +14,11 @@ namespace Infrastructure.EntityConfigurations
|
||||
public void Configure(EntityTypeBuilder<Link> builder)
|
||||
{
|
||||
builder.ToTable("Link");
|
||||
builder.HasKey(l => l.ShortCode);
|
||||
builder.HasKey(l => l.Id);
|
||||
builder.HasIndex(l => l.ShortCode).IsUnique();
|
||||
builder.Ignore(l => l.DomainEvents);
|
||||
builder.Property(l => l.AppId).IsRequired();
|
||||
builder.Property(l => l.ShortCode).HasMaxLength(11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.3" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.2.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0-alpha.2" />
|
||||
<PackageReference Include="MySqlConnector" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
15
QRCodeService/Controllers/AppController.cs
Normal file
15
QRCodeService/Controllers/AppController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRCodeService.Controllers
|
||||
{
|
||||
[Route("api/v1/[controller]")]
|
||||
public class AppController:ControllerBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
73
QRCodeService/Migrations/20210224014442_InitialCreate.Designer.cs
generated
Normal file
73
QRCodeService/Migrations/20210224014442_InitialCreate.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20210224014442_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.3");
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.AppAggregate.App", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AppKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Apps");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.LinkAggregate.Link", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AppId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FullUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ShortCode")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SuffixUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Links");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
54
QRCodeService/Migrations/20210224014442_InitialCreate.cs
Normal file
54
QRCodeService/Migrations/20210224014442_InitialCreate.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Apps",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AppKey = table.Column<string>(type: "longtext", nullable: true),
|
||||
BaseUrl = table.Column<string>(type: "longtext", nullable: true),
|
||||
Remarks = table.Column<string>(type: "longtext", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Apps", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Links",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ShortCode = table.Column<string>(type: "longtext", nullable: true),
|
||||
BaseUrl = table.Column<string>(type: "longtext", nullable: true),
|
||||
SuffixUrl = table.Column<string>(type: "longtext", nullable: true),
|
||||
FullUrl = table.Column<string>(type: "longtext", nullable: true),
|
||||
AppId = table.Column<int>(type: "int", nullable: false),
|
||||
Time = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Links", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Apps");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Links");
|
||||
}
|
||||
}
|
||||
}
|
||||
72
QRCodeService/Migrations/20210224015439_AddConfiguration.Designer.cs
generated
Normal file
72
QRCodeService/Migrations/20210224015439_AddConfiguration.Designer.cs
generated
Normal file
@@ -0,0 +1,72 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20210224015439_AddConfiguration")]
|
||||
partial class AddConfiguration
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.3");
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.AppAggregate.App", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AppKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("App");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.LinkAggregate.Link", b =>
|
||||
{
|
||||
b.Property<string>("ShortCode")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<int>("AppId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FullUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SuffixUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("ShortCode");
|
||||
|
||||
b.ToTable("Link");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
102
QRCodeService/Migrations/20210224015439_AddConfiguration.cs
Normal file
102
QRCodeService/Migrations/20210224015439_AddConfiguration.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
public partial class AddConfiguration : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Links",
|
||||
table: "Links");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Apps",
|
||||
table: "Apps");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Links",
|
||||
newName: "Link");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Apps",
|
||||
newName: "App");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortCode",
|
||||
table: "Link",
|
||||
type: "varchar(255)",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Link",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link",
|
||||
column: "ShortCode");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_App",
|
||||
table: "App",
|
||||
column: "Id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_App",
|
||||
table: "App");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Link",
|
||||
newName: "Links");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "App",
|
||||
newName: "Apps");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Links",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortCode",
|
||||
table: "Links",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(255)");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Links",
|
||||
table: "Links",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Apps",
|
||||
table: "Apps",
|
||||
column: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
77
QRCodeService/Migrations/20210224015858_SetProperty.Designer.cs
generated
Normal file
77
QRCodeService/Migrations/20210224015858_SetProperty.Designer.cs
generated
Normal file
@@ -0,0 +1,77 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20210224015858_SetProperty")]
|
||||
partial class SetProperty
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.3");
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.AppAggregate.App", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AppKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("App");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.LinkAggregate.Link", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AppId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FullUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ShortCode")
|
||||
.HasMaxLength(11)
|
||||
.HasColumnType("varchar(11)");
|
||||
|
||||
b.Property<string>("SuffixUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShortCode")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Link");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
80
QRCodeService/Migrations/20210224015858_SetProperty.cs
Normal file
80
QRCodeService/Migrations/20210224015858_SetProperty.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
public partial class SetProperty : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Link",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortCode",
|
||||
table: "Link",
|
||||
type: "varchar(11)",
|
||||
maxLength: 11,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(255)");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Link_ShortCode",
|
||||
table: "Link",
|
||||
column: "ShortCode",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Link_ShortCode",
|
||||
table: "Link");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortCode",
|
||||
table: "Link",
|
||||
type: "varchar(255)",
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(11)",
|
||||
oldMaxLength: 11,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Link",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int")
|
||||
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Link",
|
||||
table: "Link",
|
||||
column: "ShortCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
75
QRCodeService/Migrations/AppDbContextModelSnapshot.cs
Normal file
75
QRCodeService/Migrations/AppDbContextModelSnapshot.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace QRCodeService.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64)
|
||||
.HasAnnotation("ProductVersion", "5.0.3");
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.AppAggregate.App", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AppKey")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("App");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Domain.AggregateModel.LinkAggregate.Link", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AppId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FullUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ShortCode")
|
||||
.HasMaxLength(11)
|
||||
.HasColumnType("varchar(11)");
|
||||
|
||||
b.Property<string>("SuffixUrl")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShortCode")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Link");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,16 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" NoWarn="NU1605" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.1" NoWarn="NU1605" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
<PackageReference Include="MySqlConnector" Version="1.2.1" />
|
||||
<PackageReference Include="MySqlConnector" Version="1.1.0" />
|
||||
<PackageReference Include="QRCoder" Version="1.4.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace QRCodeService
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(TransactionBehaviour<,>));
|
||||
|
||||
//EFCore
|
||||
services.AddDbContextPool<AppDbContext>(
|
||||
services.AddDbContext<AppDbContext>(
|
||||
dbContextOptions => dbContextOptions
|
||||
.UseMySql(
|
||||
"server=localhost;user=root;password=root;database=qrcode",
|
||||
|
||||
Reference in New Issue
Block a user