using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Moonlight.ApiServer.Database.Migrations { /// public partial class AddedUsersAndApiKey : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Core_ApiKeys", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Secret = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), PermissionsJson = table.Column(type: "jsonb", nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Core_ApiKeys", x => x.Id); }); migrationBuilder.CreateTable( name: "Core_Users", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Username = table.Column(type: "text", nullable: false), Email = table.Column(type: "text", nullable: false), Password = table.Column(type: "text", nullable: false), TokenValidTimestamp = table.Column(type: "timestamp with time zone", nullable: false), PermissionsJson = table.Column(type: "jsonb", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Core_Users", x => x.Id); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Core_ApiKeys"); migrationBuilder.DropTable( name: "Core_Users"); } } }