修改数据库

This commit is contained in:
bibabo 2024-11-13 22:34:53 +08:00
parent 2e9d387be6
commit 0ece57fd6a
15 changed files with 97 additions and 74 deletions

View File

@ -9,7 +9,7 @@
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://*:8080"
"Url": "http://*:801"
}
}
}

View File

@ -5,10 +5,13 @@ using CloudGaming.Model.DbSqlServer.Db_User;
using Microsoft.EntityFrameworkCore;
//Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;
var optionsBuilder = new DbContextOptionsBuilder<CloudGamingPhoneContext>();
var option = optionsBuilder.UseSqlServer("Server=192.168.1.17;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
var option = optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
CloudGamingPhoneContext cloudGamingPhoneContext = new CloudGamingPhoneContext(option);
cloudGamingPhoneContext.Database.EnsureCreated();
//cloudGamingPhoneContext.Database.EnsureCreated();
var x = cloudGamingPhoneContext.T_Epg_Cfg.Count();
var ccc = cloudGamingPhoneContext.T_Epg_Cfg.ToList();
Console.WriteLine("查询" + x.ToString());
Console.ReadKey();
//Server=192.168.1.17;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;
//var optionsBuilder1 = new DbContextOptionsBuilder<CloudGamingUserContext>();
//var option1 = optionsBuilder1.UseSqlServer("Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;

View File

@ -119,8 +119,8 @@ public partial class <#= Options.ContextName #> : DbContext
var useProviderCall = providerCode.GenerateUseProvider(Options.ConnectionString);
usings.AddRange(useProviderCall.GetRequiredUsings());
#>
=> optionsBuilder<#= code.Fragment(useProviderCall, indent: 3) #>;
{// => optionsBuilder<#= code.Fragment(useProviderCall, indent: 3) #>;
}
<#
}

View File

@ -70,8 +70,8 @@ public partial class CloudGamingGameContext : DbContext
public virtual DbSet<T_Game_UserShare> T_Game_UserShare { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=192.168.1.17;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
{// => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<T_Game_ChildList>(entity =>

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace CloudGaming.GameModel.Db.Db_Game;
@ -94,7 +94,7 @@ public partial class T_Game_List
/// <summary>
/// 游戏难度
/// </summary>
public virtual string GameDifficulty { get; set; } = null!;
public virtual string? GameDifficulty { get; set; }
/// <summary>
/// 游戏发行方

View File

@ -2,7 +2,12 @@
##在API项目里面执行使用连接字符串名称生成代码到model项目
```sh
--game
内网
dotnet ef dbcontext scaffold "Server=192.168.1.17;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o Db/Db_Game/ --use-database-names --no-pluralize --force
内网穿透
dotnet ef dbcontext scaffold "Server=192.168.195.6;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o Db/Db_Game/ --use-database-names --no-pluralize --force
--Ext
dotnet ef dbcontext scaffold "Server=192.168.1.17;Database=CloudGamingCBT;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o Db/Db_Ext/ --use-database-names --no-pluralize --force
内网穿透
dotnet ef dbcontext scaffold "Server=192.168.195.6;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o Db/Db_Game/ --use-database-names --no-pluralize --force
```

View File

@ -113,7 +113,8 @@ public partial class <#= Options.ContextName #> : MultiTenantDbContext//DbContex
var useProviderCall = providerCode.GenerateUseProvider(Options.ConnectionString);
usings.AddRange(useProviderCall.GetRequiredUsings());
#>
=> optionsBuilder<#= code.Fragment(useProviderCall, indent: 3) #>;
{ // => optionsBuilder<#= code.Fragment(useProviderCall, indent: 3) #>;
}
<#
}

View File

@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
@ -144,7 +145,9 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
public virtual DbSet<T_Videos> T_Videos { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=192.168.1.17;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
// => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@ -190,6 +193,7 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
.IsUnicode(false)
.HasComment("上线渠道,0不限制")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.DefaultImageStyle).HasComment("默认使用的资源图");
entity.Property(e => e.EpgParentCategory).HasComment("epg父组Id, 0无");
entity.Property(e => e.IdName)
.HasMaxLength(50)
@ -213,6 +217,7 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
entity.Property(e => e.ShowStatus)
.HasDefaultValue(1)
.HasComment("显示状态。0全部显示1审核模式下不显示2正常模式下不显示审核显示");
entity.Property(e => e.TenantId).HasComment("租户");
//添加全局筛选器
if (this.TenantInfo != null)
{
@ -229,7 +234,6 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
entity.Property(e => e.Id).HasComment("标识");
entity.Property(e => e.Channel)
.HasMaxLength(50)
.IsUnicode(false)
.HasComment("渠道")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.Continent)
@ -256,15 +260,11 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
entity.Property(e => e.ImageId).HasComment("图片");
entity.Property(e => e.ImageId2).HasComment("图片2-预留");
entity.Property(e => e.ImageId3).HasComment("图片3");
entity.Property(e => e.ImageResStyle)
.HasMaxLength(50)
.HasComment("使用原始资源图样式n_n")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.ImageResStyle).HasComment("使用原始资源图样式n_n");
entity.Property(e => e.IsOnline).HasComment("是否启用");
entity.Property(e => e.OrderId).HasComment("排序-正序");
entity.Property(e => e.Platform)
.HasMaxLength(50)
.IsUnicode(false)
.HasComment("平台安卓还是ios")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.ResId)
@ -358,19 +358,19 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
.HasMaxLength(100)
.HasComment("游戏Id")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.GameImageId).HasComment("游戏库Icon图");
entity.Property(e => e.GameLoadBgImageId).HasComment("游戏加载图");
entity.Property(e => e.GameLoadTime).HasComment("Loading时间");
entity.Property(e => e.GameName)
.HasMaxLength(50)
.HasComment("游戏名称")
.UseCollation("Chinese_PRC_CI_AS");
entity.Property(e => e.ImageIconId).HasComment("游戏icon");
entity.Property(e => e.ImageIconId).HasComment("游戏详情logo");
entity.Property(e => e.ImageId_Banner).HasComment("顶部图片");
entity.Property(e => e.ImageId_JXTJ).HasComment("精选推荐");
entity.Property(e => e.ImageId_TJ).HasComment("推荐大图");
entity.Property(e => e.ImageId_ZJTC).HasComment("最近推出");
entity.Property(e => e.ImageId_ZXTJ).HasComment("尊享推荐");
entity.Property(e => e.ImageId_FK).HasComment("首页GTA系列大方块");
entity.Property(e => e.ImageId_RM).HasComment("首页爆款热门");
entity.Property(e => e.ImageId_ShouSuo).HasComment("搜索icon");
entity.Property(e => e.ImageId_TJ).HasComment("推荐大图(首页蘑菇必玩 = 首页热血格斗 = 游戏详情页游戏推荐)");
entity.Property(e => e.ImageId_YXK).HasComment("游戏库Icon图");
entity.Property(e => e.IsDiscount)
.HasDefaultValue(true)
.HasComment("是否参与优惠套餐活动(比如包夜卡,周中卡之类的)");

View File

@ -78,4 +78,9 @@ public partial class T_Epg_CategoryCfg: MultiTenantEntity
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}
/// <summary>
/// 默认使用的资源图
/// </summary>
public virtual int DefaultImageStyle { get; set; }
}

View File

@ -1,11 +1,11 @@
using System;
using System;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
/// <summary>
/// Epg配置表
/// </summary>
public partial class T_Epg_Cfg : MultiTenantEntity
public partial class T_Epg_Cfg: MultiTenantEntity
{
public T_Epg_Cfg() { }
@ -57,7 +57,7 @@ public partial class T_Epg_Cfg : MultiTenantEntity
/// <summary>
/// 使用原始资源图样式n_n
/// </summary>
public virtual string? ImageResStyle { get; set; }
public virtual int ImageResStyle { get; set; }
/// <summary>
/// 是否启用
@ -124,8 +124,8 @@ public partial class T_Epg_Cfg : MultiTenantEntity
/// </summary>
public virtual DateTime? CreateTime { get; set; }
/// <summary>
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
}
}

View File

@ -1,11 +1,11 @@
using System;
using System;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
/// <summary>
/// 游戏配置
/// </summary>
public partial class T_GameCBT : MultiTenantEntity
public partial class T_GameCBT: MultiTenantEntity
{
public T_GameCBT() { }
@ -21,11 +21,6 @@ public partial class T_GameCBT : MultiTenantEntity
/// </summary>
public virtual int GameBgImgId { get; set; }
/// <summary>
/// 游戏库Icon图
/// </summary>
public virtual int GameImageId { get; set; }
/// <summary>
/// 是否启用
/// </summary>
@ -62,7 +57,7 @@ public partial class T_GameCBT : MultiTenantEntity
public virtual int GameLoadBgImageId { get; set; }
/// <summary>
/// 游戏icon
/// 游戏详情logo
/// </summary>
public virtual int ImageIconId { get; set; }
@ -82,17 +77,7 @@ public partial class T_GameCBT : MultiTenantEntity
public virtual int GameLoadTime { get; set; }
/// <summary>
/// 尊享推荐
/// </summary>
public virtual int ImageId_ZXTJ { get; set; }
/// <summary>
/// 精选推荐
/// </summary>
public virtual int ImageId_JXTJ { get; set; }
/// <summary>
/// 推荐大图
/// 推荐大图(首页蘑菇必玩 = 首页热血格斗 = 游戏详情页游戏推荐)
/// </summary>
public virtual int ImageId_TJ { get; set; }
@ -106,11 +91,6 @@ public partial class T_GameCBT : MultiTenantEntity
/// </summary>
public virtual string? GameName { get; set; }
/// <summary>
/// 最近推出
/// </summary>
public virtual int ImageId_ZJTC { get; set; }
/// <summary>
/// 顶部图片
/// </summary>
@ -156,8 +136,28 @@ public partial class T_GameCBT : MultiTenantEntity
/// </summary>
public virtual string? FriendlyTips { get; set; }
/// <summary>
/// <summary>
/// 所属租户
/// </summary>
public override Guid TenantId { get; set; }
/// <summary>
/// 游戏库Icon图
/// </summary>
public virtual int ImageId_YXK { get; set; }
/// <summary>
/// 搜索icon
/// </summary>
public virtual int ImageId_ShouSuo { get; set; }
/// <summary>
/// 首页爆款热门
/// </summary>
public virtual int ImageId_RM { get; set; }
/// <summary>
/// 首页GTA系列大方块
/// </summary>
public virtual int ImageId_FK { get; set; }
}

View File

@ -89,7 +89,8 @@ public partial class CloudGamingUserContext : MultiTenantDbContext//DbContext
public virtual DbSet<T_User_Token> T_User_Token { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
{ // => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@ -413,9 +414,6 @@ public partial class CloudGamingUserContext : MultiTenantDbContext//DbContext
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.IsLogout).HasComment("是否注销");
entity.Property(e => e.LastLoginAt)
.HasComment("最后一次登录时间")
.HasColumnType("datetime");
entity.Property(e => e.NikeName)
.HasMaxLength(100)
.HasComment("用户昵称")
@ -430,11 +428,6 @@ public partial class CloudGamingUserContext : MultiTenantDbContext//DbContext
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");
entity.Property(e => e.VerificationCode)
.HasMaxLength(10)
.IsUnicode(false)
.HasComment("验证码")
.UseCollation("Chinese_PRC_CI_AS");
//添加全局筛选器
if (this.TenantInfo != null)
{
@ -451,11 +444,20 @@ public partial class CloudGamingUserContext : MultiTenantDbContext//DbContext
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.DeviceNumber)
.HasMaxLength(100)
.HasComment("设备号");
entity.Property(e => e.ExpiresAt)
.HasComment("过期时间")
.HasColumnType("datetime");
entity.Property(e => e.LastLoginAt)
.HasComment("最后一次登录时间")
.HasColumnType("datetime");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.Token).HasComment("登录token");
entity.Property(e => e.TokenMd5)
.HasMaxLength(64)
.HasComment("tokenMd5值");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");

View File

@ -29,16 +29,6 @@ public partial class T_User_Phone_Account: MultiTenantEntity
/// </summary>
public virtual string PhoneNum { get; set; } = null!;
/// <summary>
/// 验证码
/// </summary>
public virtual string VerificationCode { get; set; } = null!;
/// <summary>
/// 最后一次登录时间
/// </summary>
public virtual DateTime LastLoginAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>

View File

@ -40,4 +40,19 @@ public partial class T_User_Token: MultiTenantEntity
/// 修改时间
/// </summary>
public virtual DateTime? UpdateAt { get; set; }
/// <summary>
/// 设备号
/// </summary>
public virtual string? DeviceNumber { get; set; }
/// <summary>
/// tokenMd5值
/// </summary>
public virtual string? TokenMd5 { get; set; }
/// <summary>
/// 最后一次登录时间
/// </summary>
public virtual DateTime LastLoginAt { get; set; }
}

View File

@ -3,8 +3,10 @@
```sh
--user
dotnet ef dbcontext scaffold "Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o DbSqlServer/Db_User/ --use-database-names --no-pluralize --force
dotnet ef dbcontext scaffold "Server=192.168.195.6;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o DbSqlServer/Db_User/ --use-database-names --no-pluralize --force
--CloudGamingPhone
dotnet ef dbcontext scaffold "Server=192.168.1.17;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o DbSqlServer/Db_Phone/ --use-database-names --no-pluralize --force
dotnet ef dbcontext scaffold "Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer -o DbSqlServer/Db_Phone/ --use-database-names --no-pluralize --force
```