using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace iknow_api.Migrations { /// public partial class @new : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "User", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: true), Surname = table.Column(type: "text", nullable: true), Index = table.Column(type: "text", nullable: true), Email = table.Column(type: "text", nullable: true), PasswordHash = table.Column(type: "text", nullable: true), Bday = table.Column(type: "timestamp with time zone", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Role = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_User", x => x.Id); }); migrationBuilder.CreateTable( name: "RefreshToken", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "integer", nullable: false), Token = table.Column(type: "text", nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), IsValid = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RefreshToken", x => x.Id); table.ForeignKey( name: "FK_RefreshToken_User_UserId", column: x => x.UserId, principalTable: "User", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_RefreshToken_UserId", table: "RefreshToken", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "RefreshToken"); migrationBuilder.DropTable( name: "User"); } } }