| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddDonationGoalConfigPeriod : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<int>(
- name: "Period",
- table: "DonationGoalConfig",
- type: "int",
- nullable: false,
- defaultValue: 6);
- // 기존 row 보정: StartAt + EndAt 둘 다 있으면 Custom(5), 그 외는 AllTime(6)
- migrationBuilder.Sql(@"
- UPDATE DonationGoalConfig
- SET Period = CASE
- WHEN StartAt IS NOT NULL AND EndAt IS NOT NULL THEN 5
- ELSE 6
- END;
- ");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Period",
- table: "DonationGoalConfig");
- }
- }
- }
|