| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class RenameCoinNameToKorEngName : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameColumn(
- name: "Name",
- table: "Coin",
- newName: "KorName");
- migrationBuilder.Sql("""
- IF EXISTS (
- SELECT 1 FROM sys.extended_properties ep
- INNER JOIN sys.columns c ON ep.major_id = c.object_id AND ep.minor_id = c.column_id
- WHERE c.object_id = OBJECT_ID('Coin') AND c.name = 'KorName' AND ep.name = 'MS_Description'
- )
- EXEC sp_dropextendedproperty 'MS_Description', 'SCHEMA', 'dbo', 'TABLE', 'Coin', 'COLUMN', 'KorName';
- """);
- migrationBuilder.AlterColumn<string>(
- name: "KorName",
- table: "Coin",
- type: "nvarchar(200)",
- maxLength: 200,
- nullable: false,
- comment: "한글 이름");
- migrationBuilder.AddColumn<string>(
- name: "EngName",
- table: "Coin",
- type: "nvarchar(200)",
- maxLength: 200,
- nullable: false,
- defaultValue: "",
- comment: "영문 이름");
- migrationBuilder.Sql("UPDATE [Coin] SET [EngName] = [KorName]");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "EngName",
- table: "Coin");
- migrationBuilder.Sql("""
- IF EXISTS (
- SELECT 1 FROM sys.extended_properties ep
- INNER JOIN sys.columns c ON ep.major_id = c.object_id AND ep.minor_id = c.column_id
- WHERE c.object_id = OBJECT_ID('Coin') AND c.name = 'KorName' AND ep.name = 'MS_Description'
- )
- EXEC sp_dropextendedproperty 'MS_Description', 'SCHEMA', 'dbo', 'TABLE', 'Coin', 'COLUMN', 'KorName';
- """);
- migrationBuilder.RenameColumn(
- name: "KorName",
- table: "Coin",
- newName: "Name");
- migrationBuilder.AlterColumn<string>(
- name: "Name",
- table: "Coin",
- type: "nvarchar(200)",
- maxLength: 200,
- nullable: false,
- comment: "코인 이름");
- }
- }
- }
|