using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace RR3CommunityServer.Migrations { /// public partial class AddFriendsSocialSystem : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Clubs", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", nullable: false), Tag = table.Column(type: "TEXT", nullable: false), OwnerId = table.Column(type: "INTEGER", nullable: false), MaxMembers = table.Column(type: "INTEGER", nullable: false), IsPublic = table.Column(type: "INTEGER", nullable: false), IsRecruiting = table.Column(type: "INTEGER", nullable: false), TotalPoints = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Clubs", x => x.Id); table.ForeignKey( name: "FK_Clubs_Users_OwnerId", column: x => x.OwnerId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "FriendInvitations", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), SenderId = table.Column(type: "INTEGER", nullable: false), ReceiverId = table.Column(type: "INTEGER", nullable: false), Status = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), RespondedAt = table.Column(type: "TEXT", nullable: true), ExpiresAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FriendInvitations", x => x.Id); table.ForeignKey( name: "FK_FriendInvitations_Users_ReceiverId", column: x => x.ReceiverId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_FriendInvitations_Users_SenderId", column: x => x.SenderId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Friends", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), User1Id = table.Column(type: "INTEGER", nullable: false), User2Id = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Friends", x => x.Id); table.ForeignKey( name: "FK_Friends_Users_User1Id", column: x => x.User1Id, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Friends_Users_User2Id", column: x => x.User2Id, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Gifts", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), SenderId = table.Column(type: "INTEGER", nullable: false), ReceiverId = table.Column(type: "INTEGER", nullable: false), GiftType = table.Column(type: "TEXT", nullable: false), Amount = table.Column(type: "INTEGER", nullable: false), Message = table.Column(type: "TEXT", nullable: true), Claimed = table.Column(type: "INTEGER", nullable: false), SentAt = table.Column(type: "TEXT", nullable: false), ClaimedAt = table.Column(type: "TEXT", nullable: true), ExpiresAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Gifts", x => x.Id); table.ForeignKey( name: "FK_Gifts_Users_ReceiverId", column: x => x.ReceiverId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Gifts_Users_SenderId", column: x => x.SenderId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ClubMembers", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), ClubId = table.Column(type: "INTEGER", nullable: false), UserId = table.Column(type: "INTEGER", nullable: false), Role = table.Column(type: "TEXT", nullable: false), ContributedPoints = table.Column(type: "INTEGER", nullable: false), JoinedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ClubMembers", x => x.Id); table.ForeignKey( name: "FK_ClubMembers_Clubs_ClubId", column: x => x.ClubId, principalTable: "Clubs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ClubMembers_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 1, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 3, 3, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8910), new DateTime(2026, 2, 24, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8907) }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 2, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 3, 3, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8918), new DateTime(2026, 2, 24, 0, 47, 32, 189, DateTimeKind.Utc).AddTicks(8918) }); migrationBuilder.CreateIndex( name: "IX_ClubMembers_ClubId", table: "ClubMembers", column: "ClubId"); migrationBuilder.CreateIndex( name: "IX_ClubMembers_UserId", table: "ClubMembers", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Clubs_OwnerId", table: "Clubs", column: "OwnerId"); migrationBuilder.CreateIndex( name: "IX_FriendInvitations_ReceiverId", table: "FriendInvitations", column: "ReceiverId"); migrationBuilder.CreateIndex( name: "IX_FriendInvitations_SenderId", table: "FriendInvitations", column: "SenderId"); migrationBuilder.CreateIndex( name: "IX_Friends_User1Id", table: "Friends", column: "User1Id"); migrationBuilder.CreateIndex( name: "IX_Friends_User2Id", table: "Friends", column: "User2Id"); migrationBuilder.CreateIndex( name: "IX_Gifts_ReceiverId", table: "Gifts", column: "ReceiverId"); migrationBuilder.CreateIndex( name: "IX_Gifts_SenderId", table: "Gifts", column: "SenderId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ClubMembers"); migrationBuilder.DropTable( name: "FriendInvitations"); migrationBuilder.DropTable( name: "Friends"); migrationBuilder.DropTable( name: "Gifts"); migrationBuilder.DropTable( name: "Clubs"); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 1, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 3, 3, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6445), new DateTime(2026, 2, 24, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6442) }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 2, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 3, 3, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6454), new DateTime(2026, 2, 24, 0, 7, 51, 537, DateTimeKind.Utc).AddTicks(6453) }); } } }