MyBookmark/Modules.Rating.Api/Migrations/20250109221221_M001.cs
2025-01-20 00:49:51 +03:00

56 lines
2.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modules.Rating.Api.Migrations
{
/// <inheritdoc />
public partial class M001 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Rates");
migrationBuilder.CreateTable(
name: "Votes",
columns: table => new
{
ObjectId = table.Column<Guid>(type: "uuid", nullable: false),
SubjectId = table.Column<Guid>(type: "uuid", nullable: false),
RatingPercentage = table.Column<int>(type: "integer", nullable: false),
LastUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
VoteDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
},
constraints: table =>
{
table.PrimaryKey("PK_Votes", x => new { x.SubjectId, x.ObjectId });
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Votes");
migrationBuilder.CreateTable(
name: "Rates",
columns: table => new
{
SubjectId = table.Column<Guid>(type: "uuid", nullable: false),
ObjectId = table.Column<Guid>(type: "uuid", nullable: false),
LastUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()"),
RatePercentage = table.Column<int>(type: "integer", nullable: false),
VoteDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now()")
},
constraints: table =>
{
table.PrimaryKey("PK_Rates", x => new { x.SubjectId, x.ObjectId });
});
}
}
}