using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Microsoft.SelfService.Portal.Core.API.Migrations { /// public partial class AddOnPremApiClients : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ApiClients", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), ClientId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: false), SecretHash = table.Column(type: "nvarchar(max)", nullable: false), ScopesJson = table.Column(type: "nvarchar(max)", nullable: false), IsEnabled = table.Column(type: "bit", nullable: false), ExpiresAt = table.Column(type: "datetime2", nullable: true), LastUsedAt = table.Column(type: "datetime2", nullable: true), Modified = table.Column(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"), ModifiedBy = table.Column(type: "nvarchar(max)", nullable: false), Created = table.Column(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"), CreatedBy = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiClients", x => x.Id); table.CheckConstraint("CK_ApiClients_ScopesJson_IsJson", "ISJSON([ScopesJson]) = 1"); }); migrationBuilder.InsertData( table: "ApiClients", columns: new[] { "Id", "ClientId", "Created", "CreatedBy", "ExpiresAt", "IsEnabled", "LastUsedAt", "Modified", "ModifiedBy", "Name", "ScopesJson", "SecretHash" }, values: new object[] { new Guid("91000000-0000-0000-0000-000000000001"), "ssp-demo-worker", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", null, true, null, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Demo Worker Client", "[\"deployment.read\",\"deployment.write\",\"queue.process\",\"template.read\",\"credential.resolve\"]", "PBKDF2-SHA256.100000.c3NwLWRlbW8td29ya2VyAA==.xQxe7BHCn9pdkqHozdyspEmKnz95uCUuxVvU2vgCEbo=" }); migrationBuilder.CreateIndex( name: "IX_ApiClients_ClientId", table: "ApiClients", column: "ClientId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ApiClients"); } } }