| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace bitforum.Migrations.DefaultDb
- {
- /// <inheritdoc />
- public partial class a3 : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "BoardGroup",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- Code = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 분류 주소"),
- Name = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 분류 명"),
- Order = table.Column<int>(type: "int", nullable: false, comment: "순서"),
- Boards = table.Column<long>(type: "bigint", nullable: false, comment: "게시판 수"),
- Posts = table.Column<long>(type: "bigint", nullable: false, comment: "게시글 수"),
- Comments = table.Column<long>(type: "bigint", nullable: false, comment: "댓글 수"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_BoardGroup", x => x.ID);
- });
- migrationBuilder.CreateTable(
- name: "Board",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardGroupID = table.Column<int>(type: "int", nullable: false, comment: "분류 ID"),
- Code = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 주소"),
- Name = table.Column<string>(type: "nvarchar(70)", maxLength: 70, nullable: false, comment: "게시판 이름"),
- Order = table.Column<int>(type: "int", nullable: false, comment: "순서"),
- IsSearch = table.Column<bool>(type: "bit", nullable: false, comment: "검색 여부"),
- IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
- Posts = table.Column<int>(type: "int", nullable: false, comment: "게시글 수"),
- Comments = table.Column<int>(type: "int", nullable: false, comment: "댓글 수"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Board", x => x.ID);
- table.ForeignKey(
- name: "FK_Board_BoardGroup_BoardGroupID",
- column: x => x.BoardGroupID,
- principalTable: "BoardGroup",
- principalColumn: "ID");
- });
- migrationBuilder.CreateTable(
- name: "BoardMeta",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_BoardMeta", x => x.ID);
- table.ForeignKey(
- name: "FK_BoardMeta_Board_BoardID",
- column: x => x.BoardID,
- principalTable: "Board",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "CommentMeta",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
- EnableComment = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 사용"),
- PerPage = table.Column<int>(type: "int", nullable: false, comment: "목록 표시"),
- AllowLike = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 공감 사용"),
- AllowDisLike = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 비공감 사용"),
- ShowMemberPhoto = table.Column<bool>(type: "bit", nullable: false, comment: "회원 사진 공개"),
- ShowMemberIcon = table.Column<bool>(type: "bit", nullable: false, comment: "회원 아이콘 공개"),
- ContentPlaceholder = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "안내 문구"),
- MinContentLength = table.Column<int>(type: "int", nullable: false, comment: "최소 입력 글자"),
- MaxContentLength = table.Column<int>(type: "int", nullable: false, comment: "최대 입력 글자"),
- EnableEditor = table.Column<bool>(type: "bit", nullable: false, comment: "웹 에디터 사용"),
- AllowSecret = table.Column<bool>(type: "bit", nullable: false, comment: "비밀글 사용"),
- BlameHideCount = table.Column<int>(type: "int", nullable: false, comment: "댓글 신고 시 숨김"),
- DeleteProtectionDays = table.Column<int>(type: "int", nullable: false, comment: "댓글 삭제 금지 기간"),
- UpdateProtectionDays = table.Column<int>(type: "int", nullable: false, comment: "댓글 수정 금지 기간"),
- AllowDeleteProtection = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 보호 기능 (삭제 시)"),
- AllowUpdateProtection = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 보호 기능 (수정 시)"),
- EnableCommentUpdateLog = table.Column<bool>(type: "bit", nullable: false, comment: "댓글 변경 기록")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_CommentMeta", x => x.ID);
- table.ForeignKey(
- name: "FK_CommentMeta_Board_BoardID",
- column: x => x.BoardID,
- principalTable: "Board",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Post",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
- MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
- Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "제목"),
- Content = table.Column<string>(type: "nvarchar(max)", nullable: false, comment: "내용"),
- SID = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 SID"),
- Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true, comment: "회원 이메일"),
- Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 이름"),
- Password = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "게시글 비밀번호"),
- IsReply = table.Column<bool>(type: "bit", nullable: false, comment: "답변 여부"),
- IsSecret = table.Column<bool>(type: "bit", nullable: false, comment: "비밀글 여부"),
- IsNotice = table.Column<bool>(type: "bit", nullable: false, comment: "일반 공지 여부"),
- IsSpeaker = table.Column<bool>(type: "bit", nullable: false, comment: "전체 공지 여부"),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false, comment: "삭제 여부"),
- Views = table.Column<long>(type: "bigint", nullable: false, comment: "조회 수"),
- Likes = table.Column<long>(type: "bigint", nullable: false, comment: "좋아요"),
- Dislikes = table.Column<long>(type: "bigint", nullable: false, comment: "싫어요"),
- Comments = table.Column<long>(type: "bigint", nullable: false, comment: "댓글 수"),
- Blames = table.Column<long>(type: "bigint", nullable: false, comment: "신고 수"),
- Files = table.Column<short>(type: "smallint", nullable: false, comment: "파일 수"),
- Images = table.Column<short>(type: "smallint", nullable: false, comment: "이미지 수"),
- Videos = table.Column<short>(type: "smallint", nullable: false, comment: "동영상 수"),
- Tags = table.Column<short>(type: "smallint", nullable: false, comment: "Tag 수"),
- IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "IP"),
- UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "User-Agent"),
- LastReplyUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 답변 일시"),
- LastCommentUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 댓글 일시"),
- DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "삭제 일시"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Post", x => x.ID);
- table.ForeignKey(
- name: "FK_Post_Board_BoardID",
- column: x => x.BoardID,
- principalTable: "Board",
- principalColumn: "ID");
- table.ForeignKey(
- name: "FK_Post_Member_MemberID",
- column: x => x.MemberID,
- principalTable: "Member",
- principalColumn: "ID");
- });
- migrationBuilder.CreateTable(
- name: "PostMeta",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PostMeta", x => x.ID);
- table.ForeignKey(
- name: "FK_PostMeta_Board_BoardID",
- column: x => x.BoardID,
- principalTable: "Board",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateTable(
- name: "Comment",
- columns: table => new
- {
- ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
- .Annotation("SqlServer:Identity", "1, 1"),
- BoardID = table.Column<int>(type: "int", nullable: false, comment: "게시판 ID"),
- PostID = table.Column<int>(type: "int", nullable: false, comment: "게시글 ID"),
- MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
- ParentID = table.Column<int>(type: "int", nullable: true, comment: "부모 댓글 ID"),
- Depth = table.Column<int>(type: "int", nullable: false, comment: "댓글 깊이"),
- Content = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: false, comment: "댓글 내용"),
- SID = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 SID"),
- Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true, comment: "회원 이메일"),
- Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "회원 이름"),
- Password = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "댓글 비밀번호"),
- IsSecret = table.Column<bool>(type: "bit", nullable: false, comment: "비밀글 여부"),
- IsDeleted = table.Column<bool>(type: "bit", nullable: false, comment: "삭제 여부"),
- Likes = table.Column<long>(type: "bigint", nullable: false, comment: "좋아요"),
- Dislikes = table.Column<long>(type: "bigint", nullable: false, comment: "싫어요"),
- Blames = table.Column<long>(type: "bigint", nullable: false, comment: "신고 수"),
- Replies = table.Column<long>(type: "bigint", nullable: false, comment: "대댓글 수"),
- IpAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "IP"),
- UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "User-Agent"),
- DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "삭제 일시"),
- UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
- CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Comment", x => x.ID);
- table.ForeignKey(
- name: "FK_Comment_Board_BoardID",
- column: x => x.BoardID,
- principalTable: "Board",
- principalColumn: "ID",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_Comment_Comment_ParentID",
- column: x => x.ParentID,
- principalTable: "Comment",
- principalColumn: "ID");
- table.ForeignKey(
- name: "FK_Comment_Member_MemberID",
- column: x => x.MemberID,
- principalTable: "Member",
- principalColumn: "ID");
- table.ForeignKey(
- name: "FK_Comment_Post_PostID",
- column: x => x.PostID,
- principalTable: "Post",
- principalColumn: "ID");
- });
- migrationBuilder.CreateIndex(
- name: "IX_Board_BoardGroupID",
- table: "Board",
- column: "BoardGroupID");
- migrationBuilder.CreateIndex(
- name: "IX_Board_Code",
- table: "Board",
- column: "Code",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Board_Comments",
- table: "Board",
- column: "Comments");
- migrationBuilder.CreateIndex(
- name: "IX_Board_IsActive",
- table: "Board",
- column: "IsActive");
- migrationBuilder.CreateIndex(
- name: "IX_Board_IsSearch",
- table: "Board",
- column: "IsSearch");
- migrationBuilder.CreateIndex(
- name: "IX_Board_Name",
- table: "Board",
- column: "Name");
- migrationBuilder.CreateIndex(
- name: "IX_Board_Order",
- table: "Board",
- column: "Order");
- migrationBuilder.CreateIndex(
- name: "IX_Board_Posts",
- table: "Board",
- column: "Posts");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Boards",
- table: "BoardGroup",
- column: "Boards");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Code",
- table: "BoardGroup",
- column: "Code");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Comments",
- table: "BoardGroup",
- column: "Comments");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Name",
- table: "BoardGroup",
- column: "Name");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Order",
- table: "BoardGroup",
- column: "Order");
- migrationBuilder.CreateIndex(
- name: "IX_BoardGroup_Posts",
- table: "BoardGroup",
- column: "Posts");
- migrationBuilder.CreateIndex(
- name: "IX_BoardMeta_BoardID",
- table: "BoardMeta",
- column: "BoardID");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Blames",
- table: "Comment",
- column: "Blames");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_BoardID",
- table: "Comment",
- column: "BoardID");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_CreatedAt",
- table: "Comment",
- column: "CreatedAt");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Dislikes",
- table: "Comment",
- column: "Dislikes");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Email",
- table: "Comment",
- column: "Email");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_IsDeleted",
- table: "Comment",
- column: "IsDeleted");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_IsSecret",
- table: "Comment",
- column: "IsSecret");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Likes",
- table: "Comment",
- column: "Likes");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_MemberID",
- table: "Comment",
- column: "MemberID");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Name",
- table: "Comment",
- column: "Name");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_ParentID",
- table: "Comment",
- column: "ParentID");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_PostID",
- table: "Comment",
- column: "PostID");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_Replies",
- table: "Comment",
- column: "Replies");
- migrationBuilder.CreateIndex(
- name: "IX_Comment_SID",
- table: "Comment",
- column: "SID");
- migrationBuilder.CreateIndex(
- name: "IX_CommentMeta_BoardID",
- table: "CommentMeta",
- column: "BoardID");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Blames",
- table: "Post",
- column: "Blames");
- migrationBuilder.CreateIndex(
- name: "IX_Post_BoardID",
- table: "Post",
- column: "BoardID");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Comments",
- table: "Post",
- column: "Comments");
- migrationBuilder.CreateIndex(
- name: "IX_Post_CreatedAt",
- table: "Post",
- column: "CreatedAt");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Dislikes",
- table: "Post",
- column: "Dislikes");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Email",
- table: "Post",
- column: "Email");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Files",
- table: "Post",
- column: "Files");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Images",
- table: "Post",
- column: "Images");
- migrationBuilder.CreateIndex(
- name: "IX_Post_IsDeleted",
- table: "Post",
- column: "IsDeleted");
- migrationBuilder.CreateIndex(
- name: "IX_Post_IsNotice",
- table: "Post",
- column: "IsNotice");
- migrationBuilder.CreateIndex(
- name: "IX_Post_IsReply",
- table: "Post",
- column: "IsReply");
- migrationBuilder.CreateIndex(
- name: "IX_Post_IsSecret",
- table: "Post",
- column: "IsSecret");
- migrationBuilder.CreateIndex(
- name: "IX_Post_IsSpeaker",
- table: "Post",
- column: "IsSpeaker");
- migrationBuilder.CreateIndex(
- name: "IX_Post_LastCommentUpdatedAt",
- table: "Post",
- column: "LastCommentUpdatedAt");
- migrationBuilder.CreateIndex(
- name: "IX_Post_LastReplyUpdatedAt",
- table: "Post",
- column: "LastReplyUpdatedAt");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Likes",
- table: "Post",
- column: "Likes");
- migrationBuilder.CreateIndex(
- name: "IX_Post_MemberID",
- table: "Post",
- column: "MemberID");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Name",
- table: "Post",
- column: "Name");
- migrationBuilder.CreateIndex(
- name: "IX_Post_SID",
- table: "Post",
- column: "SID");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Subject",
- table: "Post",
- column: "Subject");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Tags",
- table: "Post",
- column: "Tags");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Videos",
- table: "Post",
- column: "Videos");
- migrationBuilder.CreateIndex(
- name: "IX_Post_Views",
- table: "Post",
- column: "Views");
- migrationBuilder.CreateIndex(
- name: "IX_PostMeta_BoardID",
- table: "PostMeta",
- column: "BoardID");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "BoardMeta");
- migrationBuilder.DropTable(
- name: "Comment");
- migrationBuilder.DropTable(
- name: "CommentMeta");
- migrationBuilder.DropTable(
- name: "PostMeta");
- migrationBuilder.DropTable(
- name: "Post");
- migrationBuilder.DropTable(
- name: "Board");
- migrationBuilder.DropTable(
- name: "BoardGroup");
- }
- }
- }
|