Startpunkten

This commit is contained in:
2026-03-05 15:43:26 +01:00
commit dd99fb7b01
95 changed files with 3262 additions and 0 deletions

View File

@@ -0,0 +1,156 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PersonSport.Models;
namespace PersonSport.Migrations
{
[DbContext(typeof(IdrottContext))]
[Migration("20211013071744_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("PersonSport.Models.Admin", b =>
{
b.Property<int>("AdminId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(80)
.HasColumnType("TEXT");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.HasKey("AdminId");
b.ToTable("Administratorer");
});
modelBuilder.Entity("PersonSport.Models.Person", b =>
{
b.Property<int>("PersonId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Alder")
.HasColumnType("INTEGER");
b.Property<string>("Epost")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("PersonNamn")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime>("StartDatum")
.HasColumnType("TEXT");
b.Property<string>("Visningsbild")
.HasMaxLength(80)
.HasColumnType("TEXT");
b.HasKey("PersonId");
b.ToTable("Personer");
});
modelBuilder.Entity("PersonSport.Models.PersonSport", b =>
{
b.Property<int>("PersonId")
.HasColumnType("INTEGER");
b.Property<int>("SportId")
.HasColumnType("INTEGER");
b.Property<DateTime>("StartDatum")
.HasColumnType("TEXT");
b.HasKey("PersonId", "SportId");
b.HasIndex("SportId");
b.ToTable("PersonSport");
});
modelBuilder.Entity("PersonSport.Models.Sport", b =>
{
b.Property<int>("SportId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bakgrundsbild")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<string>("DetaljText")
.HasMaxLength(2000)
.HasColumnType("TEXT");
b.Property<string>("Ingress")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("SportNamn")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Traningstider")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("SportId");
b.ToTable("Sporter");
});
modelBuilder.Entity("PersonSport.Models.PersonSport", b =>
{
b.HasOne("PersonSport.Models.Person", "Person")
.WithMany("PersonSporter")
.HasForeignKey("PersonId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PersonSport.Models.Sport", "Sport")
.WithMany("PersonSporter")
.HasForeignKey("SportId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Person");
b.Navigation("Sport");
});
modelBuilder.Entity("PersonSport.Models.Person", b =>
{
b.Navigation("PersonSporter");
});
modelBuilder.Entity("PersonSport.Models.Sport", b =>
{
b.Navigation("PersonSporter");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,104 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace PersonSport.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Administratorer",
columns: table => new
{
AdminId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Username = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
Password = table.Column<string>(type: "TEXT", maxLength: 80, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Administratorer", x => x.AdminId);
});
migrationBuilder.CreateTable(
name: "Personer",
columns: table => new
{
PersonId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PersonNamn = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Epost = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Alder = table.Column<int>(type: "INTEGER", nullable: false),
StartDatum = table.Column<DateTime>(type: "TEXT", nullable: false),
Visningsbild = table.Column<string>(type: "TEXT", maxLength: 80, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Personer", x => x.PersonId);
});
migrationBuilder.CreateTable(
name: "Sporter",
columns: table => new
{
SportId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SportNamn = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Bakgrundsbild = table.Column<string>(type: "TEXT", maxLength: 60, nullable: false),
Ingress = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
DetaljText = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
Traningstider = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Sporter", x => x.SportId);
});
migrationBuilder.CreateTable(
name: "PersonSport",
columns: table => new
{
PersonId = table.Column<int>(type: "INTEGER", nullable: false),
SportId = table.Column<int>(type: "INTEGER", nullable: false),
StartDatum = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PersonSport", x => new { x.PersonId, x.SportId });
table.ForeignKey(
name: "FK_PersonSport_Personer_PersonId",
column: x => x.PersonId,
principalTable: "Personer",
principalColumn: "PersonId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_PersonSport_Sporter_SportId",
column: x => x.SportId,
principalTable: "Sporter",
principalColumn: "SportId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_PersonSport_SportId",
table: "PersonSport",
column: "SportId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Administratorer");
migrationBuilder.DropTable(
name: "PersonSport");
migrationBuilder.DropTable(
name: "Personer");
migrationBuilder.DropTable(
name: "Sporter");
}
}
}

View File

@@ -0,0 +1,154 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PersonSport.Models;
namespace PersonSport.Migrations
{
[DbContext(typeof(IdrottContext))]
partial class IdrottContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.10");
modelBuilder.Entity("PersonSport.Models.Admin", b =>
{
b.Property<int>("AdminId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(80)
.HasColumnType("TEXT");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.HasKey("AdminId");
b.ToTable("Administratorer");
});
modelBuilder.Entity("PersonSport.Models.Person", b =>
{
b.Property<int>("PersonId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Alder")
.HasColumnType("INTEGER");
b.Property<string>("Epost")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("PersonNamn")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime>("StartDatum")
.HasColumnType("TEXT");
b.Property<string>("Visningsbild")
.HasMaxLength(80)
.HasColumnType("TEXT");
b.HasKey("PersonId");
b.ToTable("Personer");
});
modelBuilder.Entity("PersonSport.Models.PersonSport", b =>
{
b.Property<int>("PersonId")
.HasColumnType("INTEGER");
b.Property<int>("SportId")
.HasColumnType("INTEGER");
b.Property<DateTime>("StartDatum")
.HasColumnType("TEXT");
b.HasKey("PersonId", "SportId");
b.HasIndex("SportId");
b.ToTable("PersonSport");
});
modelBuilder.Entity("PersonSport.Models.Sport", b =>
{
b.Property<int>("SportId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bakgrundsbild")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<string>("DetaljText")
.HasMaxLength(2000)
.HasColumnType("TEXT");
b.Property<string>("Ingress")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("SportNamn")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Traningstider")
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("SportId");
b.ToTable("Sporter");
});
modelBuilder.Entity("PersonSport.Models.PersonSport", b =>
{
b.HasOne("PersonSport.Models.Person", "Person")
.WithMany("PersonSporter")
.HasForeignKey("PersonId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("PersonSport.Models.Sport", "Sport")
.WithMany("PersonSporter")
.HasForeignKey("SportId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Person");
b.Navigation("Sport");
});
modelBuilder.Entity("PersonSport.Models.Person", b =>
{
b.Navigation("PersonSporter");
});
modelBuilder.Entity("PersonSport.Models.Sport", b =>
{
b.Navigation("PersonSporter");
});
#pragma warning restore 612, 618
}
}
}