51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace SpotiParty.Web.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Addedevents : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Events",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
HostUserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
|
Start = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
End = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Events", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Events_Users_HostUserId",
|
|
column: x => x.HostUserId,
|
|
principalTable: "Users",
|
|
principalColumn: "UserId",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Events_HostUserId",
|
|
table: "Events",
|
|
column: "HostUserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Events");
|
|
}
|
|
}
|
|
}
|