49 lines
1.9 KiB
C#
49 lines
1.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace OpenArchival.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedViewCountObject : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ArtifactGroupingViewCounts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
ArtifactGroupingId = table.Column<int>(type: "integer", nullable: false),
|
|
Views = table.Column<int>(type: "integer", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ArtifactGroupingViewCounts", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ArtifactGroupingViewCounts_ArtifactGroupings_ArtifactGroupi~",
|
|
column: x => x.ArtifactGroupingId,
|
|
principalTable: "ArtifactGroupings",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ArtifactGroupingViewCounts_ArtifactGroupingId",
|
|
table: "ArtifactGroupingViewCounts",
|
|
column: "ArtifactGroupingId",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ArtifactGroupingViewCounts");
|
|
}
|
|
}
|
|
}
|