mirror of
https://github.com/bitwarden/server.git
synced 2026-06-01 01:55:55 -05:00
* Send.Key and Send.Data NOT NULL * backfill EF providers with empty strings for NULL Data or Key values * update migration names to match current date
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Bit.PostgresMigrations.Migrations;
|
|
|
|
/// <inheritdoc />
|
|
public partial class SendKeyAndDataNotNull : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql("UPDATE \"Send\" SET \"Key\" = '' WHERE \"Key\" IS NULL;");
|
|
migrationBuilder.Sql("UPDATE \"Send\" SET \"Data\" = '' WHERE \"Data\" IS NULL;");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Key",
|
|
table: "Send",
|
|
type: "text",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "text",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Data",
|
|
table: "Send",
|
|
type: "text",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "text",
|
|
oldNullable: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Key",
|
|
table: "Send",
|
|
type: "text",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "text");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "Data",
|
|
table: "Send",
|
|
type: "text",
|
|
nullable: true,
|
|
oldClrType: typeof(string),
|
|
oldType: "text");
|
|
}
|
|
}
|