You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.2 KiB
57 lines
2.2 KiB
using Microsoft.EntityFrameworkCore.Migrations; |
|
|
|
#nullable disable |
|
|
|
namespace Bit.PostgresMigrations.Migrations; |
|
|
|
/// <inheritdoc /> |
|
public partial class AddTable_OrganizationInstallation : Migration |
|
{ |
|
/// <inheritdoc /> |
|
protected override void Up(MigrationBuilder migrationBuilder) |
|
{ |
|
migrationBuilder.CreateTable( |
|
name: "OrganizationInstallation", |
|
columns: table => new |
|
{ |
|
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false), |
|
InstallationId = table.Column<Guid>(type: "uuid", nullable: false), |
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true) |
|
}, |
|
constraints: table => |
|
{ |
|
table.PrimaryKey("PK_OrganizationInstallation", x => x.Id); |
|
table.ForeignKey( |
|
name: "FK_OrganizationInstallation_Installation_InstallationId", |
|
column: x => x.InstallationId, |
|
principalTable: "Installation", |
|
principalColumn: "Id", |
|
onDelete: ReferentialAction.Cascade); |
|
table.ForeignKey( |
|
name: "FK_OrganizationInstallation_Organization_OrganizationId", |
|
column: x => x.OrganizationId, |
|
principalTable: "Organization", |
|
principalColumn: "Id", |
|
onDelete: ReferentialAction.Cascade); |
|
}); |
|
|
|
migrationBuilder.CreateIndex( |
|
name: "IX_OrganizationInstallation_InstallationId", |
|
table: "OrganizationInstallation", |
|
column: "InstallationId"); |
|
|
|
migrationBuilder.CreateIndex( |
|
name: "IX_OrganizationInstallation_OrganizationId", |
|
table: "OrganizationInstallation", |
|
column: "OrganizationId"); |
|
} |
|
|
|
/// <inheritdoc /> |
|
protected override void Down(MigrationBuilder migrationBuilder) |
|
{ |
|
migrationBuilder.DropTable( |
|
name: "OrganizationInstallation"); |
|
} |
|
}
|
|
|