mirror of
https://github.com/bitwarden/server.git
synced 2024-11-28 13:15:12 +01:00
bfa9269b42
* [deps]: Update Duende.IdentityServer to v6.3.6 * Fix test * Grant table changes * Reassert view * EF migrations * Restore non-null key and simpler index * Master SQL sync * Lint * Fix ID setting since the property isn't exposed * Bump to .7 * Point to new Duende package * Drop unused indexes first --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
121 lines
3.4 KiB
C#
121 lines
3.4 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace Bit.PostgresMigrations.Migrations;
|
|
|
|
/// <inheritdoc />
|
|
public partial class GrantIdWithIndexes : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Grant",
|
|
table: "Grant");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Type",
|
|
table: "Grant",
|
|
type: "character varying(50)",
|
|
maxLength: 50,
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(50)",
|
|
oldMaxLength: 50,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Data",
|
|
table: "Grant",
|
|
type: "text",
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "text",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClientId",
|
|
table: "Grant",
|
|
type: "character varying(200)",
|
|
maxLength: 200,
|
|
nullable: false,
|
|
defaultValue: "",
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(200)",
|
|
oldMaxLength: 200,
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "Id",
|
|
table: "Grant",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Grant",
|
|
table: "Grant",
|
|
column: "Id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Grant_Key",
|
|
table: "Grant",
|
|
column: "Key",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropPrimaryKey(
|
|
name: "PK_Grant",
|
|
table: "Grant");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Grant_Key",
|
|
table: "Grant");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Id",
|
|
table: "Grant");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Type",
|
|
table: "Grant",
|
|
type: "character varying(50)",
|
|
maxLength: 50,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(50)",
|
|
oldMaxLength: 50);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Data",
|
|
table: "Grant",
|
|
type: "text",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "text");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "ClientId",
|
|
table: "Grant",
|
|
type: "character varying(200)",
|
|
maxLength: 200,
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "character varying(200)",
|
|
oldMaxLength: 200);
|
|
|
|
migrationBuilder.AddPrimaryKey(
|
|
name: "PK_Grant",
|
|
table: "Grant",
|
|
column: "Key");
|
|
}
|
|
}
|