mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
173 lines
8.2 KiB
C#
173 lines
8.2 KiB
C#
using System;
|
|
using BTCPayServer.Data;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace BTCPayServer.Migrations
|
|
{
|
|
[DbContext(typeof(ApplicationDbContext))]
|
|
[Migration("20190225091644_AddOpenIddict")]
|
|
public partial class AddOpenIddict : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
int? maxLength = this.IsMySql(migrationBuilder.ActiveProvider) ? (int?)255 : null;
|
|
migrationBuilder.CreateTable(
|
|
name: "OpenIddictApplications",
|
|
columns: table => new
|
|
{
|
|
ClientId = table.Column<string>(maxLength: 100, nullable: false),
|
|
ClientSecret = table.Column<string>(nullable: true),
|
|
ConcurrencyToken = table.Column<string>(maxLength: 50, nullable: true),
|
|
ConsentType = table.Column<string>(nullable: true),
|
|
DisplayName = table.Column<string>(nullable: true),
|
|
Id = table.Column<string>(nullable: false, maxLength: maxLength),
|
|
Permissions = table.Column<string>(nullable: true),
|
|
PostLogoutRedirectUris = table.Column<string>(nullable: true),
|
|
Properties = table.Column<string>(nullable: true),
|
|
RedirectUris = table.Column<string>(nullable: true),
|
|
Type = table.Column<string>(maxLength: 25, nullable: false),
|
|
ApplicationUserId = table.Column<string>(nullable: true, maxLength: maxLength)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_OpenIddictApplications", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_OpenIddictApplications_AspNetUsers_ApplicationUserId",
|
|
column: x => x.ApplicationUserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OpenIddictScopes",
|
|
columns: table => new
|
|
{
|
|
ConcurrencyToken = table.Column<string>(maxLength: 50, nullable: true),
|
|
Description = table.Column<string>(nullable: true),
|
|
DisplayName = table.Column<string>(nullable: true),
|
|
Id = table.Column<string>(nullable: false, maxLength: maxLength),
|
|
Name = table.Column<string>(maxLength: 200, nullable: false),
|
|
Properties = table.Column<string>(nullable: true),
|
|
Resources = table.Column<string>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_OpenIddictScopes", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OpenIddictAuthorizations",
|
|
columns: table => new
|
|
{
|
|
ApplicationId = table.Column<string>(nullable: true, maxLength: maxLength),
|
|
ConcurrencyToken = table.Column<string>(maxLength: 50, nullable: true),
|
|
Id = table.Column<string>(nullable: false, maxLength: maxLength),
|
|
Properties = table.Column<string>(nullable: true),
|
|
Scopes = table.Column<string>(nullable: true),
|
|
Status = table.Column<string>(maxLength: 25, nullable: false),
|
|
Subject = table.Column<string>(maxLength: 450, nullable: false),
|
|
Type = table.Column<string>(maxLength: 25, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId",
|
|
column: x => x.ApplicationId,
|
|
principalTable: "OpenIddictApplications",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "OpenIddictTokens",
|
|
columns: table => new
|
|
{
|
|
ApplicationId = table.Column<string>(nullable: true, maxLength: maxLength),
|
|
AuthorizationId = table.Column<string>(nullable: true, maxLength: maxLength),
|
|
ConcurrencyToken = table.Column<string>(maxLength: 50, nullable: true),
|
|
CreationDate = table.Column<DateTimeOffset>(nullable: true),
|
|
ExpirationDate = table.Column<DateTimeOffset>(nullable: true),
|
|
Id = table.Column<string>(nullable: false, maxLength: maxLength),
|
|
Payload = table.Column<string>(nullable: true),
|
|
Properties = table.Column<string>(nullable: true),
|
|
ReferenceId = table.Column<string>(maxLength: 100, nullable: true),
|
|
Status = table.Column<string>(maxLength: 25, nullable: false),
|
|
Subject = table.Column<string>(maxLength: 450, nullable: false),
|
|
Type = table.Column<string>(maxLength: 25, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_OpenIddictTokens", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId",
|
|
column: x => x.ApplicationId,
|
|
principalTable: "OpenIddictApplications",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId",
|
|
column: x => x.AuthorizationId,
|
|
principalTable: "OpenIddictAuthorizations",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictApplications_ApplicationUserId",
|
|
table: "OpenIddictApplications",
|
|
column: "ApplicationUserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictApplications_ClientId",
|
|
table: "OpenIddictApplications",
|
|
column: "ClientId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
|
|
table: "OpenIddictAuthorizations",
|
|
columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictScopes_Name",
|
|
table: "OpenIddictScopes",
|
|
column: "Name",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictTokens_AuthorizationId",
|
|
table: "OpenIddictTokens",
|
|
column: "AuthorizationId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictTokens_ReferenceId",
|
|
table: "OpenIddictTokens",
|
|
column: "ReferenceId",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type",
|
|
table: "OpenIddictTokens",
|
|
columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "OpenIddictScopes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "OpenIddictTokens");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "OpenIddictAuthorizations");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "OpenIddictApplications");
|
|
}
|
|
}
|
|
}
|