| 123456789101112131415161718192021222324252627282930313233 |
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb;
- /// <inheritdoc />
- public partial class NormalizeChannelHandleStripAtPrefix : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- // 기존 저장된 Channel.Handle 값에서 '@' 접두사 제거 (canonical form 통일)
- migrationBuilder.Sql(@"
- UPDATE [Channel]
- SET [Handle] = STUFF([Handle], 1, 1, '')
- WHERE [Handle] LIKE N'@%';
- ");
- // 이력 테이블도 방어적 정규화
- migrationBuilder.Sql(@"
- UPDATE [ChannelHandleHistory]
- SET [OldHandle] = STUFF([OldHandle], 1, 1, '')
- WHERE [OldHandle] LIKE N'@%';
- ");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- // 데이터 정규화는 되돌릴 수 없음 (원본 '@' 접두사 유무를 기억하지 않음) — no-op
- }
- }
|