2019-06-17 03:59:33 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
2020-02-10 02:10:18 +00:00
|
|
|
|
namespace Marechai.Database.Migrations
|
2019-06-17 03:59:33 +01:00
|
|
|
|
{
|
|
|
|
|
|
public partial class AddCompaniesByMagazine : Migration
|
|
|
|
|
|
{
|
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
|
{
|
2020-02-10 22:44:18 +00:00
|
|
|
|
migrationBuilder.CreateTable("CompaniesByMagazines", table => new
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = table.Column<long>().
|
|
|
|
|
|
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
|
|
|
|
CompanyId = table.Column<int>(), MagazineId = table.Column<long>(),
|
|
|
|
|
|
RoleId = table.Column<string>("char(3)")
|
|
|
|
|
|
}, constraints: table =>
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PrimaryKey("PK_CompaniesByMagazines", x => x.Id);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_CompaniesByMagazines_DocumentCompanies_CompanyId", x => x.CompanyId,
|
|
|
|
|
|
"DocumentCompanies", "Id", onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_CompaniesByMagazines_Magazines_MagazineId", x => x.MagazineId, "Magazines", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
|
|
|
|
|
|
table.ForeignKey("FK_CompaniesByMagazines_DocumentRoles_RoleId", x => x.RoleId, "DocumentRoles", "Id",
|
|
|
|
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
|
|
});
|
2019-06-17 03:59:33 +01:00
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_CompaniesByMagazines_CompanyId", "CompaniesByMagazines", "CompanyId");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_CompaniesByMagazines_MagazineId", "CompaniesByMagazines", "MagazineId");
|
|
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateIndex("IX_CompaniesByMagazines_RoleId", "CompaniesByMagazines", "RoleId");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-10 22:44:18 +00:00
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) =>
|
2019-06-17 03:59:33 +01:00
|
|
|
|
migrationBuilder.DropTable("CompaniesByMagazines");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|