优化扩展

This commit is contained in:
橙子
2021-10-13 15:40:56 +08:00
parent 16eb1fb1e2
commit e9bc71393c
28 changed files with 687 additions and 326 deletions

View File

@@ -1,39 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211010110842_yi-1")]
partial class yi1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("age")
.HasColumnType("INTEGER");
b.Property<string>("name")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("user");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class yi1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
name = table.Column<string>(type: "TEXT", nullable: true),
age = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user", x => x.id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "user");
}
}
}

View File

@@ -1,78 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211011082334_yi-2")]
partial class yi2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("introduce")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("role_name")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("age")
.HasColumnType("INTEGER");
b.Property<string>("email")
.HasColumnType("TEXT");
b.Property<string>("icon")
.HasColumnType("TEXT");
b.Property<string>("ip")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("nick")
.HasColumnType("TEXT");
b.Property<string>("password")
.HasColumnType("TEXT");
b.Property<string>("username")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("user");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,120 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class yi2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "name",
table: "user",
newName: "username");
migrationBuilder.AlterColumn<int>(
name: "age",
table: "user",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AddColumn<string>(
name: "email",
table: "user",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "icon",
table: "user",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ip",
table: "user",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "is_delete",
table: "user",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "nick",
table: "user",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "password",
table: "user",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "role",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
role_name = table.Column<string>(type: "TEXT", nullable: true),
introduce = table.Column<string>(type: "TEXT", nullable: true),
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_role", x => x.id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "role");
migrationBuilder.DropColumn(
name: "email",
table: "user");
migrationBuilder.DropColumn(
name: "icon",
table: "user");
migrationBuilder.DropColumn(
name: "ip",
table: "user");
migrationBuilder.DropColumn(
name: "is_delete",
table: "user");
migrationBuilder.DropColumn(
name: "nick",
table: "user");
migrationBuilder.DropColumn(
name: "password",
table: "user");
migrationBuilder.RenameColumn(
name: "username",
table: "user",
newName: "name");
migrationBuilder.AlterColumn<int>(
name: "age",
table: "user",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}

View File

@@ -0,0 +1,218 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Yi.Framework.Model;
namespace Yi.Framework.Model.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20211013073148_yi-1")]
partial class yi1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("icon")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<int?>("is_top")
.HasColumnType("INTEGER");
b.Property<string>("menu_name")
.HasColumnType("TEXT");
b.Property<int?>("menuid")
.HasColumnType("INTEGER");
b.Property<int?>("mouldid")
.HasColumnType("INTEGER");
b.Property<string>("router")
.HasColumnType("TEXT");
b.Property<int?>("sort")
.HasColumnType("INTEGER");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("mould_name")
.HasColumnType("TEXT");
b.Property<string>("url")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("introduce")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("role_name")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("role");
});
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("age")
.HasColumnType("INTEGER");
b.Property<string>("email")
.HasColumnType("TEXT");
b.Property<string>("icon")
.HasColumnType("TEXT");
b.Property<string>("introduction")
.HasColumnType("TEXT");
b.Property<string>("ip")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("nick")
.HasColumnType("TEXT");
b.Property<string>("password")
.HasColumnType("TEXT");
b.Property<string>("username")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("user");
});
modelBuilder.Entity("menurole", b =>
{
b.Property<int>("menusid")
.HasColumnType("INTEGER");
b.Property<int>("rolesid")
.HasColumnType("INTEGER");
b.HasKey("menusid", "rolesid");
b.HasIndex("rolesid");
b.ToTable("menurole");
});
modelBuilder.Entity("roleuser", b =>
{
b.Property<int>("rolesid")
.HasColumnType("INTEGER");
b.Property<int>("usersid")
.HasColumnType("INTEGER");
b.HasKey("rolesid", "usersid");
b.HasIndex("usersid");
b.ToTable("roleuser");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.Navigation("mould");
});
modelBuilder.Entity("menurole", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany()
.HasForeignKey("menusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("roleuser", b =>
{
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany()
.HasForeignKey("usersid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,182 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Yi.Framework.Model.Migrations
{
public partial class yi1 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "mould",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
mould_name = table.Column<string>(type: "TEXT", nullable: true),
url = table.Column<string>(type: "TEXT", nullable: true),
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_mould", x => x.id);
});
migrationBuilder.CreateTable(
name: "role",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
role_name = table.Column<string>(type: "TEXT", nullable: true),
introduce = table.Column<string>(type: "TEXT", nullable: true),
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_role", x => x.id);
});
migrationBuilder.CreateTable(
name: "user",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
username = table.Column<string>(type: "TEXT", nullable: true),
password = table.Column<string>(type: "TEXT", nullable: true),
icon = table.Column<string>(type: "TEXT", nullable: true),
nick = table.Column<string>(type: "TEXT", nullable: true),
email = table.Column<string>(type: "TEXT", nullable: true),
ip = table.Column<string>(type: "TEXT", nullable: true),
age = table.Column<int>(type: "INTEGER", nullable: true),
introduction = table.Column<string>(type: "TEXT", nullable: true),
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user", x => x.id);
});
migrationBuilder.CreateTable(
name: "menu",
columns: table => new
{
id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
icon = table.Column<string>(type: "TEXT", nullable: true),
router = table.Column<string>(type: "TEXT", nullable: true),
menu_name = table.Column<string>(type: "TEXT", nullable: true),
mouldid = table.Column<int>(type: "INTEGER", nullable: true),
menuid = table.Column<int>(type: "INTEGER", nullable: true),
is_delete = table.Column<int>(type: "INTEGER", nullable: false),
is_top = table.Column<int>(type: "INTEGER", nullable: true),
sort = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_menu", x => x.id);
table.ForeignKey(
name: "FK_menu_menu_menuid",
column: x => x.menuid,
principalTable: "menu",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_menu_mould_mouldid",
column: x => x.mouldid,
principalTable: "mould",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "roleuser",
columns: table => new
{
rolesid = table.Column<int>(type: "INTEGER", nullable: false),
usersid = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_roleuser", x => new { x.rolesid, x.usersid });
table.ForeignKey(
name: "FK_roleuser_role_rolesid",
column: x => x.rolesid,
principalTable: "role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_roleuser_user_usersid",
column: x => x.usersid,
principalTable: "user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "menurole",
columns: table => new
{
menusid = table.Column<int>(type: "INTEGER", nullable: false),
rolesid = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_menurole", x => new { x.menusid, x.rolesid });
table.ForeignKey(
name: "FK_menurole_menu_menusid",
column: x => x.menusid,
principalTable: "menu",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_menurole_role_rolesid",
column: x => x.rolesid,
principalTable: "role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_menu_menuid",
table: "menu",
column: "menuid");
migrationBuilder.CreateIndex(
name: "IX_menu_mouldid",
table: "menu",
column: "mouldid");
migrationBuilder.CreateIndex(
name: "IX_menurole_rolesid",
table: "menurole",
column: "rolesid");
migrationBuilder.CreateIndex(
name: "IX_roleuser_usersid",
table: "roleuser",
column: "usersid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "menurole");
migrationBuilder.DropTable(
name: "roleuser");
migrationBuilder.DropTable(
name: "menu");
migrationBuilder.DropTable(
name: "role");
migrationBuilder.DropTable(
name: "user");
migrationBuilder.DropTable(
name: "mould");
}
}
}

View File

@@ -16,6 +16,65 @@ namespace Yi.Framework.Model.Migrations
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("icon")
.HasColumnType("TEXT");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<int?>("is_top")
.HasColumnType("INTEGER");
b.Property<string>("menu_name")
.HasColumnType("TEXT");
b.Property<int?>("menuid")
.HasColumnType("INTEGER");
b.Property<int?>("mouldid")
.HasColumnType("INTEGER");
b.Property<string>("router")
.HasColumnType("TEXT");
b.Property<int?>("sort")
.HasColumnType("INTEGER");
b.HasKey("id");
b.HasIndex("menuid");
b.HasIndex("mouldid");
b.ToTable("menu");
});
modelBuilder.Entity("Yi.Framework.Model.Models.mould", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("is_delete")
.HasColumnType("INTEGER");
b.Property<string>("mould_name")
.HasColumnType("TEXT");
b.Property<string>("url")
.HasColumnType("TEXT");
b.HasKey("id");
b.ToTable("mould");
});
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
{
b.Property<int>("id")
@@ -51,6 +110,9 @@ namespace Yi.Framework.Model.Migrations
b.Property<string>("icon")
.HasColumnType("TEXT");
b.Property<string>("introduction")
.HasColumnType("TEXT");
b.Property<string>("ip")
.HasColumnType("TEXT");
@@ -70,6 +132,84 @@ namespace Yi.Framework.Model.Migrations
b.ToTable("user");
});
modelBuilder.Entity("menurole", b =>
{
b.Property<int>("menusid")
.HasColumnType("INTEGER");
b.Property<int>("rolesid")
.HasColumnType("INTEGER");
b.HasKey("menusid", "rolesid");
b.HasIndex("rolesid");
b.ToTable("menurole");
});
modelBuilder.Entity("roleuser", b =>
{
b.Property<int>("rolesid")
.HasColumnType("INTEGER");
b.Property<int>("usersid")
.HasColumnType("INTEGER");
b.HasKey("rolesid", "usersid");
b.HasIndex("usersid");
b.ToTable("roleuser");
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany("children")
.HasForeignKey("menuid");
b.HasOne("Yi.Framework.Model.Models.mould", "mould")
.WithMany()
.HasForeignKey("mouldid");
b.Navigation("mould");
});
modelBuilder.Entity("menurole", b =>
{
b.HasOne("Yi.Framework.Model.Models.menu", null)
.WithMany()
.HasForeignKey("menusid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("roleuser", b =>
{
b.HasOne("Yi.Framework.Model.Models.role", null)
.WithMany()
.HasForeignKey("rolesid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Yi.Framework.Model.Models.user", null)
.WithMany()
.HasForeignKey("usersid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Yi.Framework.Model.Models.menu", b =>
{
b.Navigation("children");
});
#pragma warning restore 612, 618
}
}

View File

@@ -10,6 +10,6 @@ namespace Yi.Framework.Model.Models
{
public string mould_name { get; set; }
public string url { get; set; }
public menu menu { get; set; }
//public menu menu { get; set; }
}
}