using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace MyOffice.Migrations.Postgres.Migrations { /// public partial class VerificationCode : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Verifications", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "uuid", nullable: false), Code = table.Column(type: "text", nullable: false), DestinationType = table.Column(type: "text", nullable: false), Destination = table.Column(type: "text", nullable: false), CreatedOn = table.Column(type: "timestamp with time zone", nullable: false), ExpiresOn = table.Column(type: "timestamp with time zone", nullable: false), VerifiedOn = table.Column(type: "timestamp with time zone", nullable: true), Template = table.Column(type: "text", nullable: false), Metadata = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Verifications", x => x.Id); table.ForeignKey( name: "FK_Verifications_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Verifications_UserId", table: "Verifications", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Verifications"); } } }