using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace VigilCareClinicalAPI.Migrations { /// public partial class AddRefreshTokens : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "refresh_tokens", columns: table => new { id = table.Column(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"), token = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), user_id = table.Column(type: "uuid", nullable: false), expires_at = table.Column(type: "timestamp with time zone", nullable: false), created_at = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "NOW()"), revoked_at = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_refresh_tokens", x => x.id); table.ForeignKey( name: "FK_refresh_tokens_clinical_users_user_id", column: x => x.user_id, principalTable: "clinical_users", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_refresh_tokens_token", table: "refresh_tokens", column: "token", unique: true); migrationBuilder.CreateIndex( name: "IX_refresh_tokens_user_id", table: "refresh_tokens", column: "user_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "refresh_tokens"); } } }