using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace GerbilManagerWebAPI.Migrations { /// public partial class AddRequestsAndMailSettings : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "MailSettings", columns: table => new { Id = table.Column(type: "uuid", nullable: false), GmailAddress = table.Column(type: "text", nullable: true), AppPasswordProtected = table.Column(type: "text", nullable: true), PollIntervalMinutes = table.Column(type: "integer", nullable: false), Folder = table.Column(type: "text", nullable: false), BackgroundPollEnabled = table.Column(type: "boolean", nullable: false), LastUid = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MailSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "Requests", columns: table => new { Id = table.Column(type: "uuid", nullable: false), GmailMessageId = table.Column(type: "text", nullable: false), ThreadId = table.Column(type: "text", nullable: true), InReplyToMessageId = table.Column(type: "text", nullable: true), ReferencesHeader = table.Column(type: "text", nullable: true), FromAddress = table.Column(type: "text", nullable: false), FromName = table.Column(type: "text", nullable: true), Subject = table.Column(type: "text", nullable: true), BodyText = table.Column(type: "text", nullable: true), ReceivedAt = table.Column(type: "timestamp with time zone", nullable: false), Status = table.Column(type: "text", nullable: false), AssignedContactId = table.Column(type: "uuid", nullable: true), DraftReply = table.Column(type: "text", nullable: true), AnsweredAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Requests", x => x.Id); table.ForeignKey( name: "FK_Requests_Contacts_AssignedContactId", column: x => x.AssignedContactId, principalTable: "Contacts", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.InsertData( table: "MailSettings", columns: new[] { "Id", "AppPasswordProtected", "BackgroundPollEnabled", "Folder", "GmailAddress", "LastUid", "PollIntervalMinutes" }, values: new object[] { new Guid("ab0c0000-0000-0000-0000-000000000001"), null, false, "INBOX", null, 0L, 15 }); migrationBuilder.CreateIndex( name: "IX_Requests_AssignedContactId", table: "Requests", column: "AssignedContactId"); migrationBuilder.CreateIndex( name: "IX_Requests_GmailMessageId", table: "Requests", column: "GmailMessageId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "MailSettings"); migrationBuilder.DropTable( name: "Requests"); } } }