mirror of
https://github.com/bitwarden/server.git
synced 2024-12-05 14:23:30 +01:00
402 lines
12 KiB
C#
402 lines
12 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace Bit.PostgresMigrations.Migrations;
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class UpdateNullConstraints : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Culture",
|
|||
|
table: "User",
|
|||
|
type: "character varying(10)",
|
|||
|
maxLength: 10,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(10)",
|
|||
|
oldMaxLength: 10,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "PostalCode",
|
|||
|
table: "TaxRate",
|
|||
|
type: "character varying(10)",
|
|||
|
maxLength: 10,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(10)",
|
|||
|
oldMaxLength: 10,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Country",
|
|||
|
table: "TaxRate",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "PlanName",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "InvoiceId",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "ClientName",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Txt",
|
|||
|
table: "OrganizationDomain",
|
|||
|
type: "text",
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "DomainName",
|
|||
|
table: "OrganizationDomain",
|
|||
|
type: "character varying(255)",
|
|||
|
maxLength: 255,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(255)",
|
|||
|
oldMaxLength: 255,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "ApiKey",
|
|||
|
table: "OrganizationApiKey",
|
|||
|
type: "character varying(30)",
|
|||
|
maxLength: 30,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(30)",
|
|||
|
oldMaxLength: 30,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Key",
|
|||
|
table: "Installation",
|
|||
|
type: "character varying(150)",
|
|||
|
maxLength: 150,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(150)",
|
|||
|
oldMaxLength: 150,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Email",
|
|||
|
table: "Installation",
|
|||
|
type: "character varying(256)",
|
|||
|
maxLength: 256,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(256)",
|
|||
|
oldMaxLength: 256,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "Device",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Identifier",
|
|||
|
table: "Device",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "Collection",
|
|||
|
type: "text",
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Scope",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(4000)",
|
|||
|
maxLength: 4000,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(4000)",
|
|||
|
oldMaxLength: 4000,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(200)",
|
|||
|
maxLength: 200,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(200)",
|
|||
|
oldMaxLength: 200,
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Key",
|
|||
|
table: "ApiKey",
|
|||
|
type: "text",
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "EncryptedPayload",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(4000)",
|
|||
|
maxLength: 4000,
|
|||
|
nullable: false,
|
|||
|
defaultValue: "",
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(4000)",
|
|||
|
oldMaxLength: 4000,
|
|||
|
oldNullable: true);
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Culture",
|
|||
|
table: "User",
|
|||
|
type: "character varying(10)",
|
|||
|
maxLength: 10,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(10)",
|
|||
|
oldMaxLength: 10);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "PostalCode",
|
|||
|
table: "TaxRate",
|
|||
|
type: "character varying(10)",
|
|||
|
maxLength: 10,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(10)",
|
|||
|
oldMaxLength: 10);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Country",
|
|||
|
table: "TaxRate",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "PlanName",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "InvoiceId",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "ClientName",
|
|||
|
table: "ProviderInvoiceItem",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Txt",
|
|||
|
table: "OrganizationDomain",
|
|||
|
type: "text",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "DomainName",
|
|||
|
table: "OrganizationDomain",
|
|||
|
type: "character varying(255)",
|
|||
|
maxLength: 255,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(255)",
|
|||
|
oldMaxLength: 255);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "ApiKey",
|
|||
|
table: "OrganizationApiKey",
|
|||
|
type: "character varying(30)",
|
|||
|
maxLength: 30,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(30)",
|
|||
|
oldMaxLength: 30);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Key",
|
|||
|
table: "Installation",
|
|||
|
type: "character varying(150)",
|
|||
|
maxLength: 150,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(150)",
|
|||
|
oldMaxLength: 150);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Email",
|
|||
|
table: "Installation",
|
|||
|
type: "character varying(256)",
|
|||
|
maxLength: 256,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(256)",
|
|||
|
oldMaxLength: 256);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "Device",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Identifier",
|
|||
|
table: "Device",
|
|||
|
type: "character varying(50)",
|
|||
|
maxLength: 50,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(50)",
|
|||
|
oldMaxLength: 50);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "Collection",
|
|||
|
type: "text",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Scope",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(4000)",
|
|||
|
maxLength: 4000,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(4000)",
|
|||
|
oldMaxLength: 4000);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Name",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(200)",
|
|||
|
maxLength: 200,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(200)",
|
|||
|
oldMaxLength: 200);
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "Key",
|
|||
|
table: "ApiKey",
|
|||
|
type: "text",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "text");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<string>(
|
|||
|
name: "EncryptedPayload",
|
|||
|
table: "ApiKey",
|
|||
|
type: "character varying(4000)",
|
|||
|
maxLength: 4000,
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(string),
|
|||
|
oldType: "character varying(4000)",
|
|||
|
oldMaxLength: 4000);
|
|||
|
}
|
|||
|
}
|