init
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class HomePageConfiguration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "HomePageConfigurationId",
|
||||
table: "SearchPageSliderEntries",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsHomePageSlider",
|
||||
table: "SearchPageSliderEntries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "HomePageConfigurationId",
|
||||
table: "ArtifactFilePaths",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HomePageConfiguration",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Content = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HomePageConfiguration", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SearchPageSliderEntries_HomePageConfigurationId",
|
||||
table: "SearchPageSliderEntries",
|
||||
column: "HomePageConfigurationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactFilePaths_HomePageConfigurationId",
|
||||
table: "ArtifactFilePaths",
|
||||
column: "HomePageConfigurationId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ArtifactFilePaths_HomePageConfiguration_HomePageConfigurati~",
|
||||
table: "ArtifactFilePaths",
|
||||
column: "HomePageConfigurationId",
|
||||
principalTable: "HomePageConfiguration",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SearchPageSliderEntries_HomePageConfiguration_HomePageConfi~",
|
||||
table: "SearchPageSliderEntries",
|
||||
column: "HomePageConfigurationId",
|
||||
principalTable: "HomePageConfiguration",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ArtifactFilePaths_HomePageConfiguration_HomePageConfigurati~",
|
||||
table: "ArtifactFilePaths");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SearchPageSliderEntries_HomePageConfiguration_HomePageConfi~",
|
||||
table: "SearchPageSliderEntries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HomePageConfiguration");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SearchPageSliderEntries_HomePageConfigurationId",
|
||||
table: "SearchPageSliderEntries");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactFilePaths_HomePageConfigurationId",
|
||||
table: "ArtifactFilePaths");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HomePageConfigurationId",
|
||||
table: "SearchPageSliderEntries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsHomePageSlider",
|
||||
table: "SearchPageSliderEntries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HomePageConfigurationId",
|
||||
table: "ArtifactFilePaths");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user