From 81a3d24eebc797108983f6bfe95c52639cf8e1ca Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Mon, 14 Aug 2023 13:49:48 +0200 Subject: [PATCH] feat: initial migration --- .../20230814114414_Initial.Designer.cs | 60 +++++++++++++++++++ .../DB/Migrations/20230814114414_Initial.cs | 38 ++++++++++++ .../WonderkingContextModelSnapshot.cs | 57 ++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 Server/DB/Migrations/20230814114414_Initial.Designer.cs create mode 100644 Server/DB/Migrations/20230814114414_Initial.cs create mode 100644 Server/DB/Migrations/WonderkingContextModelSnapshot.cs diff --git a/Server/DB/Migrations/20230814114414_Initial.Designer.cs b/Server/DB/Migrations/20230814114414_Initial.Designer.cs new file mode 100644 index 0000000..9cb6461 --- /dev/null +++ b/Server/DB/Migrations/20230814114414_Initial.Designer.cs @@ -0,0 +1,60 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Server.DB; + +#nullable disable + +namespace Server.DB.Migrations +{ + [DbContext(typeof(WonderkingContext))] + [Migration("20230814114414_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Server.DB.Documents.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("PermissionLevel") + .HasColumnType("smallint"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("Username") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.ToTable("Accounts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Server/DB/Migrations/20230814114414_Initial.cs b/Server/DB/Migrations/20230814114414_Initial.cs new file mode 100644 index 0000000..0a8961f --- /dev/null +++ b/Server/DB/Migrations/20230814114414_Initial.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Server.DB.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Accounts", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Username = table.Column(type: "varchar(20)", nullable: false), + Password = table.Column(type: "bytea", nullable: false), + Email = table.Column(type: "text", nullable: false), + PermissionLevel = table.Column(type: "smallint", nullable: false), + Salt = table.Column(type: "bytea", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Accounts", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Accounts"); + } + } +} diff --git a/Server/DB/Migrations/WonderkingContextModelSnapshot.cs b/Server/DB/Migrations/WonderkingContextModelSnapshot.cs new file mode 100644 index 0000000..5b2e1f5 --- /dev/null +++ b/Server/DB/Migrations/WonderkingContextModelSnapshot.cs @@ -0,0 +1,57 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Server.DB; + +#nullable disable + +namespace Server.DB.Migrations +{ + [DbContext(typeof(WonderkingContext))] + partial class WonderkingContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Server.DB.Documents.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("PermissionLevel") + .HasColumnType("smallint"); + + b.Property("Salt") + .IsRequired() + .HasColumnType("bytea"); + + b.Property("Username") + .IsRequired() + .HasColumnType("varchar(20)"); + + b.HasKey("Id"); + + b.ToTable("Accounts"); + }); +#pragma warning restore 612, 618 + } + } +}