Skip to content

Commit

Permalink
Readded migrations since they're needed for the github build action
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldhej committed Nov 14, 2024
1 parent c8ce41c commit b820f89
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace GirafAPI.Data.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
public partial class initialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
Expand All @@ -30,11 +30,11 @@ protected override void Up(MigrationBuilder migrationBuilder)
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
FirstName = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
LastName = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
PasswordHash = table.Column<string>(type: "TEXT", nullable: true),
Expand Down Expand Up @@ -80,6 +80,21 @@ protected override void Up(MigrationBuilder migrationBuilder)
table.PrimaryKey("PK_Organizations", x => x.Id);
});

migrationBuilder.CreateTable(
name: "Pictograms",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
OrganizationId = table.Column<int>(type: "INTEGER", nullable: false),
PictogramName = table.Column<string>(type: "TEXT", nullable: false),
PictogramUrl = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Pictograms", x => x.Id);
});

migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
Expand Down Expand Up @@ -269,6 +284,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
StartTime = table.Column<TimeOnly>(type: "TEXT", nullable: false),
EndTime = table.Column<TimeOnly>(type: "TEXT", nullable: false),
IsCompleted = table.Column<bool>(type: "INTEGER", nullable: false),
PictogramId = table.Column<int>(type: "INTEGER", nullable: false),
CitizenId = table.Column<int>(type: "INTEGER", nullable: true),
GradeId = table.Column<int>(type: "INTEGER", nullable: true)
},
Expand All @@ -285,6 +301,12 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: x => x.GradeId,
principalTable: "Grades",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Activities_Pictograms_PictogramId",
column: x => x.PictogramId,
principalTable: "Pictograms",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.CreateIndex(
Expand All @@ -297,6 +319,11 @@ protected override void Up(MigrationBuilder migrationBuilder)
table: "Activities",
column: "GradeId");

migrationBuilder.CreateIndex(
name: "IX_Activities_PictogramId",
table: "Activities",
column: "PictogramId");

migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
Expand Down Expand Up @@ -385,6 +412,9 @@ protected override void Down(MigrationBuilder migrationBuilder)
migrationBuilder.DropTable(
name: "Citizens");

migrationBuilder.DropTable(
name: "Pictograms");

migrationBuilder.DropTable(
name: "AspNetRoles");

Expand Down
37 changes: 37 additions & 0 deletions GirafAPI/Data/Migrations/GirafDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.IsRequired()
.HasColumnType("TEXT");

b.Property<int>("PictogramId")
.HasColumnType("INTEGER");

b.Property<TimeOnly>("StartTime")
.HasColumnType("TEXT");

Expand All @@ -55,6 +58,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasIndex("GradeId");

b.HasIndex("PictogramId");

b.ToTable("Activities");
});

Expand Down Expand Up @@ -145,6 +150,28 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("Organizations");
});

modelBuilder.Entity("GirafAPI.Entities.Pictograms.Pictogram", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");

b.Property<int>("OrganizationId")
.HasColumnType("INTEGER");

b.Property<string>("PictogramName")
.IsRequired()
.HasColumnType("TEXT");

b.Property<string>("PictogramUrl")
.IsRequired()
.HasColumnType("TEXT");

b.HasKey("Id");

b.ToTable("Pictograms");
});

modelBuilder.Entity("GirafAPI.Entities.Users.GirafUser", b =>
{
b.Property<string>("Id")
Expand All @@ -158,6 +185,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("TEXT");

b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");

Expand Down Expand Up @@ -204,6 +232,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("INTEGER");

b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");

Expand Down Expand Up @@ -371,6 +400,14 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasOne("GirafAPI.Entities.Grades.Grade", null)
.WithMany("Activities")
.HasForeignKey("GradeId");

b.HasOne("GirafAPI.Entities.Pictograms.Pictogram", "Pictogram")
.WithMany()
.HasForeignKey("PictogramId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Pictogram");
});

modelBuilder.Entity("GirafAPI.Entities.Citizens.Citizen", b =>
Expand Down

0 comments on commit b820f89

Please sign in to comment.