1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
bitwarden-server/util/SqliteMigrations/Migrations/20231214162537_GrantIdWithIndexes.cs
Matt Bishop b97a1a9ed2
[PM-5519] [PM-5526] [PM-5624] [PM-5600] More Grant SQL fixes (#3668)
* SQLite scripts to apply autoincrementing Id key

* Drop erroneous Id column if created
2024-01-16 09:08:55 -05:00

35 lines
886 B
C#

using Bit.EfShared;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class GrantIdWithIndexes : Migration
{
private const string _scriptLocationTemplate = "2023-12-04_00_{0}_GrantIndexes.sql";
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.CreateIndex(
name: "IX_Grant_Key",
table: "Grant",
column: "Key",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.SqlResource(_scriptLocationTemplate);
migrationBuilder.DropIndex(
name: "IX_Grant_Key",
table: "Grant");
}
}