| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class RemoveNews : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "RssNewsArticle");
- migrationBuilder.DropTable(
- name: "RssFeedSource");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "RssFeedSource",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시"),
- Description = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "소스 설명"),
- IntervalMinutes = table.Column<int>(type: "int", nullable: false, comment: "수집 주기 (분)"),
- IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "활성화 여부"),
- LastFetchedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 수집 일시"),
- Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "소스 이름"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
- Url = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false, comment: "RSS 피드 URL")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RssFeedSource", x => x.ID);
- },
- comment: "RSS 피드 소스");
- migrationBuilder.CreateTable(
- name: "RssNewsArticle",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- RssFeedSourceID = table.Column<int>(type: "int", nullable: false, comment: "RSS 피드 소스 FK"),
- Author = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "작성자"),
- Categories = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "카테고리 (JSON 배열)"),
- CommentCount = table.Column<int>(type: "int", nullable: false, comment: "댓글 수"),
- Content = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "본문 (content:encoded)"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "수집 일시"),
- Description = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "요약"),
- Guid = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "RSS GUID (중복 방지)"),
- ImageUrl = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true, comment: "썸네일 이미지 URL"),
- Link = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true, comment: "원본 링크"),
- PublishedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "발행 일시"),
- SourceName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "출처명"),
- Title = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false, comment: "기사 제목")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RssNewsArticle", x => x.ID);
- table.ForeignKey(
- name: "FK_RssNewsArticle_RssFeedSource_RssFeedSourceID",
- column: x => x.RssFeedSourceID,
- principalTable: "RssFeedSource",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- },
- comment: "RSS 뉴스 기사");
- migrationBuilder.CreateIndex(
- name: "IX_RssFeedSource_IsActive",
- table: "RssFeedSource",
- column: "IsActive");
- migrationBuilder.CreateIndex(
- name: "IX_RssFeedSource_Url",
- table: "RssFeedSource",
- column: "Url",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_RssNewsArticle_CreatedAt",
- table: "RssNewsArticle",
- column: "CreatedAt");
- migrationBuilder.CreateIndex(
- name: "IX_RssNewsArticle_Guid_RssFeedSourceID",
- table: "RssNewsArticle",
- columns: new[] { "Guid", "RssFeedSourceID" },
- unique: true,
- filter: "[Guid] IS NOT NULL");
- migrationBuilder.CreateIndex(
- name: "IX_RssNewsArticle_PublishedAt",
- table: "RssNewsArticle",
- column: "PublishedAt");
- migrationBuilder.CreateIndex(
- name: "IX_RssNewsArticle_RssFeedSourceID",
- table: "RssNewsArticle",
- column: "RssFeedSourceID");
- }
- }
- }
|