using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace SpotiParty.Web.Migrations { /// public partial class Addedevents : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Events", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), HostUserId = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Start = table.Column(type: "timestamp with time zone", nullable: false), End = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Events"); } } }