using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace UserManagement.Domain.Migrations { /// public partial class VERSION_V2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "CompanyProfiles", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: true), LogoUrl = table.Column(type: "nvarchar(max)", nullable: true), BannerUrl = table.Column(type: "nvarchar(max)", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "uniqueidentifier", nullable: false), ModifiedDate = table.Column(type: "datetime2", nullable: false), ModifiedBy = table.Column(type: "uniqueidentifier", nullable: false), DeletedDate = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CompanyProfiles", x => x.Id); }); migrationBuilder.CreateTable( name: "PageHelpers", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(max)", nullable: true), Name = table.Column(type: "nvarchar(max)", nullable: true), Description = table.Column(type: "nvarchar(max)", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "uniqueidentifier", nullable: false), ModifiedDate = table.Column(type: "datetime2", nullable: false), ModifiedBy = table.Column(type: "uniqueidentifier", nullable: false), DeletedDate = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PageHelpers", x => x.Id); }); migrationBuilder.CreateTable( name: "Reminders", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Subject = table.Column(type: "nvarchar(max)", nullable: true), Message = table.Column(type: "nvarchar(max)", nullable: true), Frequency = table.Column(type: "int", nullable: true), StartDate = table.Column(type: "datetime2", nullable: false), EndDate = table.Column(type: "datetime2", nullable: true), DayOfWeek = table.Column(type: "int", nullable: true), IsRepeated = table.Column(type: "bit", nullable: false), IsEmailNotification = table.Column(type: "bit", nullable: false), CreatedDate = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "uniqueidentifier", nullable: false), ModifiedDate = table.Column(type: "datetime2", nullable: false), ModifiedBy = table.Column(type: "uniqueidentifier", nullable: false), DeletedDate = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Reminders", x => x.Id); }); migrationBuilder.CreateTable( name: "ReminderSchedulers", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Duration = table.Column(type: "datetime2", nullable: false), IsActive = table.Column(type: "bit", nullable: false), Frequency = table.Column(type: "int", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: false), UserId = table.Column(type: "uniqueidentifier", nullable: false), IsRead = table.Column(type: "bit", nullable: false), IsEmailNotification = table.Column(type: "bit", nullable: false), Subject = table.Column(type: "nvarchar(max)", nullable: true), Message = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ReminderSchedulers", x => x.Id); table.ForeignKey( name: "FK_ReminderSchedulers_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserNotifications", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), UserId = table.Column(type: "uniqueidentifier", nullable: false), Message = table.Column(type: "nvarchar(max)", nullable: true), IsRead = table.Column(type: "bit", nullable: false), NotificationsType = table.Column(type: "int", nullable: false), CreatedDate = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "uniqueidentifier", nullable: false), ModifiedDate = table.Column(type: "datetime2", nullable: false), ModifiedBy = table.Column(type: "uniqueidentifier", nullable: false), DeletedDate = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserNotifications", x => x.Id); table.ForeignKey( name: "FK_UserNotifications_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "DailyReminders", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ReminderId = table.Column(type: "uniqueidentifier", nullable: false), DayOfWeek = table.Column(type: "int", nullable: false), IsActive = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_DailyReminders", x => x.Id); table.ForeignKey( name: "FK_DailyReminders_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "HalfYearlyReminders", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ReminderId = table.Column(type: "uniqueidentifier", nullable: false), Day = table.Column(type: "int", nullable: false), Month = table.Column(type: "int", nullable: false), Quarter = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_HalfYearlyReminders", x => x.Id); table.ForeignKey( name: "FK_HalfYearlyReminders_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "QuarterlyReminders", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ReminderId = table.Column(type: "uniqueidentifier", nullable: false), Day = table.Column(type: "int", nullable: false), Month = table.Column(type: "int", nullable: false), Quarter = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_QuarterlyReminders", x => x.Id); table.ForeignKey( name: "FK_QuarterlyReminders_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ReminderNotifications", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), ReminderId = table.Column(type: "uniqueidentifier", nullable: false), Subject = table.Column(type: "nvarchar(max)", nullable: true), Description = table.Column(type: "nvarchar(max)", nullable: true), FetchDateTime = table.Column(type: "datetime2", nullable: false), IsDeleted = table.Column(type: "bit", nullable: false), IsEmailNotification = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ReminderNotifications", x => x.Id); table.ForeignKey( name: "FK_ReminderNotifications_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ReminderUsers", columns: table => new { ReminderId = table.Column(type: "uniqueidentifier", nullable: false), UserId = table.Column(type: "uniqueidentifier", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ReminderUsers", x => new { x.ReminderId, x.UserId }); table.ForeignKey( name: "FK_ReminderUsers_Reminders_ReminderId", column: x => x.ReminderId, principalTable: "Reminders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ReminderUsers_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_DailyReminders_ReminderId", table: "DailyReminders", column: "ReminderId"); migrationBuilder.CreateIndex( name: "IX_HalfYearlyReminders_ReminderId", table: "HalfYearlyReminders", column: "ReminderId"); migrationBuilder.CreateIndex( name: "IX_QuarterlyReminders_ReminderId", table: "QuarterlyReminders", column: "ReminderId"); migrationBuilder.CreateIndex( name: "IX_ReminderNotifications_ReminderId", table: "ReminderNotifications", column: "ReminderId"); migrationBuilder.CreateIndex( name: "IX_ReminderSchedulers_UserId", table: "ReminderSchedulers", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_ReminderUsers_UserId", table: "ReminderUsers", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserNotifications_UserId", table: "UserNotifications", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CompanyProfiles"); migrationBuilder.DropTable( name: "DailyReminders"); migrationBuilder.DropTable( name: "HalfYearlyReminders"); migrationBuilder.DropTable( name: "PageHelpers"); migrationBuilder.DropTable( name: "QuarterlyReminders"); migrationBuilder.DropTable( name: "ReminderNotifications"); migrationBuilder.DropTable( name: "ReminderSchedulers"); migrationBuilder.DropTable( name: "ReminderUsers"); migrationBuilder.DropTable( name: "UserNotifications"); migrationBuilder.DropTable( name: "Reminders"); } } }