diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xml b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xml deleted file mode 100644 index be68c182b..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xsd b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xsd deleted file mode 100644 index 3f3946e28..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql.csproj b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql.csproj deleted file mode 100644 index 5af36315b..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - net8.0 - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.en.md b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.en.md deleted file mode 100644 index 114aad0be..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.en.md +++ /dev/null @@ -1,59 +0,0 @@ -# MySQL Database Migration Guide - -This guide will help you manage MySQL database migrations using the migration scripts. - -## Prerequisites - -1. Ensure .NET Core SDK is installed -2. Ensure Entity Framework Core tools are installed - ```powershell - dotnet tool install --global dotnet-ef - ``` -3. Ensure MySQL connection string is properly configured - -## Usage Instructions - -### 1. Create New Migration - -1. Run the migration script in the `aspnet-core/migrations` directory: - ```powershell - # Use English version - .\MigrateEn.ps1 - - # Or use Chinese version - .\Migrate.ps1 - ``` - -2. Select MySQL database context from the menu: - ``` - [1] PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql - ``` - -3. Enter migration name (optional): - - Press Enter to use default name: `AddNewMigration_yyyyMMdd_HHmmss` - - Or enter custom name, e.g.: `AddNewFeature` - -### 2. Generate SQL Script - -After creating the migration, the script will ask if you want to generate SQL script: - -1. Choose whether to generate SQL script (Y/N) -2. If Y is selected, following options will be available: - - `[A]` - Generate SQL script for all migrations - - `[L]` - Generate SQL script for latest migration only - - `[0-9]` - Generate from specified migration version - -Generated SQL scripts will be saved in: -``` -aspnet-core/InitSql/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/ -``` - -### 3. Apply Migration - -Generated SQL scripts can be applied to database through: - -1. Using MySQL client tools to execute SQL script directly -2. Or using command line: - ```powershell - mysql -u your_username -p your_database < your_script.sql - ``` diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.md b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.md deleted file mode 100644 index c43698e9c..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# MySQL 数据库迁移指南 - -本指南将帮助您使用迁移脚本来管理 MySQL 数据库的迁移操作。 - -## 前置条件 - -1. 确保已安装 .NET Core SDK -2. 确保已安装 Entity Framework Core 工具 - ```powershell - dotnet tool install --global dotnet-ef - ``` -3. 确保已正确配置 MySQL 连接字符串 - -## 使用说明 - -### 1. 创建新的迁移 - -1. 在 `aspnet-core/migrations` 目录下运行迁移脚本: - ```powershell - # 使用中文版本 - .\Migrate.ps1 - - # 或使用英文版本 - .\MigrateEn.ps1 - ``` - -2. 在菜单中选择 MySQL 数据库上下文: - ``` - [1] PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql - ``` - -3. 输入迁移名称(可选): - - 直接回车将使用默认名称:`AddNewMigration_yyyyMMdd_HHmmss` - - 或输入自定义名称,如:`AddNewFeature` - -### 2. 生成 SQL 脚本 - -在创建迁移后,脚本会询问是否需要生成 SQL 脚本: - -1. 选择是否生成 SQL 脚本 (Y/N) -2. 如果选择 Y,将提供以下选项: - - `[A]` - 生成所有迁移的 SQL 脚本 - - `[L]` - 仅生成最新迁移的 SQL 脚本 - - `[0-9]` - 从指定的迁移版本开始生成 - -生成的 SQL 脚本将保存在: -``` -aspnet-core/InitSql/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/ -``` - -### 3. 应用迁移 - -生成的 SQL 脚本可以通过以下方式应用到数据库: - -1. 使用 MySQL 客户端工具直接执行 SQL 脚本 -2. 或使用命令行: - ```powershell - mysql -u your_username -p your_database < your_script.sql - ``` diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsDbContextFactory.cs b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsDbContextFactory.cs deleted file mode 100644 index 3a0f90125..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsDbContextFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -using PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Configuration; -using System.IO; - -namespace PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql; - -public class SingleMigrationsDbContextFactory : IDesignTimeDbContextFactory -{ - public SingleMigrationsDbContext CreateDbContext(string[] args) - { - var configuration = BuildConfiguration(); - var connectionString = configuration.GetConnectionString("Default"); - - var builder = new DbContextOptionsBuilder() - .UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), b => b.MigrationsAssembly("PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql")); - - return new SingleMigrationsDbContext(builder!.Options); - } - - private static IConfigurationRoot BuildConfiguration() - { - var builder = new ConfigurationBuilder() - .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), - "../PackageName.CompanyName.ProjectName.AIO.DbMigrator/")) - .AddJsonFile("appsettings.json", optional: false) - .AddJsonFile("appsettings.MySql.json", optional: true); - - return builder.Build(); - } -} diff --git a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs b/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs deleted file mode 100644 index 79c9b3a1b..000000000 --- a/aspnet-core/templates/aio/content/migrations/PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs +++ /dev/null @@ -1,24 +0,0 @@ -using PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore.MySQL; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName.AIO.EntityFrameworkCore.MySql; - -[DependsOn( - typeof(AbpEntityFrameworkCoreMySQLModule), - typeof(SingleMigrationsEntityFrameworkCoreModule) - )] -public class SingleMigrationsEntityFrameworkCoreMySqlModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAbpDbContext(); - - Configure(options => - { - options.UseMySQL(); - }); - } -}