1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

[EC-427] Add mysql migration script

This commit is contained in:
Rui Tome
2022-12-27 10:40:34 +00:00
parent de1af22c0b
commit b5bb8e228e
2 changed files with 35 additions and 26 deletions

View File

@ -2,36 +2,35 @@
#nullable disable #nullable disable
namespace Bit.MySqlMigrations.Migrations namespace Bit.MySqlMigrations.Migrations;
public partial class ProviderAddProviderTypeBillingPhone : Migration
{ {
public partial class ProviderAddProviderTypeBillingPhone : Migration protected override void Up(MigrationBuilder migrationBuilder)
{ {
protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.AddColumn<string>(
{ name: "BillingPhone",
migrationBuilder.AddColumn<string>( table: "Provider",
name: "BillingPhone", type: "longtext",
table: "Provider", nullable: true)
type: "longtext", .Annotation("MySql:CharSet", "utf8mb4");
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<byte>( migrationBuilder.AddColumn<byte>(
name: "Type", name: "Type",
table: "Provider", table: "Provider",
type: "tinyint unsigned", type: "tinyint unsigned",
nullable: false, nullable: false,
defaultValue: (byte)0); defaultValue: (byte)0);
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "BillingPhone", name: "BillingPhone",
table: "Provider"); table: "Provider");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "Type", name: "Type",
table: "Provider"); table: "Provider");
}
} }
} }

View File

@ -0,0 +1,10 @@
START TRANSACTION;
ALTER TABLE `Provider` ADD `BillingPhone` longtext CHARACTER SET utf8mb4 NULL;
ALTER TABLE `Provider` ADD `Type` tinyint unsigned NOT NULL DEFAULT 0;
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
VALUES ('20221226164641_ProviderAddProviderTypeBillingPhone', '6.0.12');
COMMIT;