using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace pointMaster.Migrations { /// public partial class DateTime : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Patruljer", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Patruljer", x => x.Id); }); migrationBuilder.CreateTable( name: "Poster", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false), Location = table.Column(type: "text", nullable: false), Description = table.Column(type: "text", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Poster", x => x.Id); }); migrationBuilder.CreateTable( name: "PatruljeMedlemmer", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false), Age = table.Column(type: "integer", nullable: false), PatruljeId = table.Column(type: "integer", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_PatruljeMedlemmer", x => x.Id); table.ForeignKey( name: "FK_PatruljeMedlemmer_Patruljer_PatruljeId", column: x => x.PatruljeId, principalTable: "Patruljer", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Points", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Points = table.Column(type: "integer", nullable: false), Turnout = table.Column(type: "integer", nullable: false), PatruljeId = table.Column(type: "integer", nullable: false), PosterId = table.Column(type: "integer", nullable: false), DateCreated = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Points", x => x.Id); table.ForeignKey( name: "FK_Points_Patruljer_PatruljeId", column: x => x.PatruljeId, principalTable: "Patruljer", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Points_Poster_PosterId", column: x => x.PosterId, principalTable: "Poster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_PatruljeMedlemmer_PatruljeId", table: "PatruljeMedlemmer", column: "PatruljeId"); migrationBuilder.CreateIndex( name: "IX_Points_PatruljeId", table: "Points", column: "PatruljeId"); migrationBuilder.CreateIndex( name: "IX_Points_PosterId", table: "Points", column: "PosterId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PatruljeMedlemmer"); migrationBuilder.DropTable( name: "Points"); migrationBuilder.DropTable( name: "Patruljer"); migrationBuilder.DropTable( name: "Poster"); } } }