From 556226b09b194e7995d7cc901a294f480f7e6a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Kub=C3=AD=C4=8Dek?= Date: Thu, 17 Sep 2026 20:38:39 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99eps=C3=A1n=C3=AD=20na=20sqlite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0260501160159_SwitchToIdentity.Designer.cs | 277 ------------------ .../Migrations/20260917152052_Invites.cs | 35 --- ...ner.cs => 20260917183831_Init.Designer.cs} | 95 +++--- ...chToIdentity.cs => 20260917183831_Init.cs} | 97 +++--- .../Migrations/AppDbContextModelSnapshot.cs | 91 +++--- web/StuzkovakWeb/Program.cs | 7 +- web/StuzkovakWeb/StuzkovakWeb.csproj | 8 +- web/StuzkovakWeb/appsettings.json | 2 +- web/docker-compose.yaml | 20 +- 9 files changed, 151 insertions(+), 481 deletions(-) delete mode 100644 web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.Designer.cs delete mode 100644 web/StuzkovakWeb/Migrations/20260917152052_Invites.cs rename web/StuzkovakWeb/Migrations/{20260917152052_Invites.Designer.cs => 20260917183831_Init.Designer.cs} (75%) rename web/StuzkovakWeb/Migrations/{20260501160159_SwitchToIdentity.cs => 20260917183831_Init.cs} (71%) diff --git a/web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.Designer.cs b/web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.Designer.cs deleted file mode 100644 index 0e175ba..0000000 --- a/web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.Designer.cs +++ /dev/null @@ -1,277 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using StuzkovakWeb.Data; - -#nullable disable - -namespace StuzkovakWeb.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20260501160159_SwitchToIdentity")] - partial class SwitchToIdentity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("StuzkovakWeb.Entities.UserEntity", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("StuzkovakWeb.Entities.UserEntity", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("StuzkovakWeb.Entities.UserEntity", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("StuzkovakWeb.Entities.UserEntity", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/web/StuzkovakWeb/Migrations/20260917152052_Invites.cs b/web/StuzkovakWeb/Migrations/20260917152052_Invites.cs deleted file mode 100644 index f015e6c..0000000 --- a/web/StuzkovakWeb/Migrations/20260917152052_Invites.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace StuzkovakWeb.Migrations -{ - /// - public partial class Invites : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Invites", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - TeacherName = table.Column(type: "text", nullable: false), - IsAccepted = table.Column(type: "boolean", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Invites", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Invites"); - } - } -} diff --git a/web/StuzkovakWeb/Migrations/20260917152052_Invites.Designer.cs b/web/StuzkovakWeb/Migrations/20260917183831_Init.Designer.cs similarity index 75% rename from web/StuzkovakWeb/Migrations/20260917152052_Invites.Designer.cs rename to web/StuzkovakWeb/Migrations/20260917183831_Init.Designer.cs index 5232907..c73f297 100644 --- a/web/StuzkovakWeb/Migrations/20260917152052_Invites.Designer.cs +++ b/web/StuzkovakWeb/Migrations/20260917183831_Init.Designer.cs @@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using StuzkovakWeb.Data; #nullable disable @@ -12,35 +11,31 @@ using StuzkovakWeb.Data; namespace StuzkovakWeb.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20260917152052_Invites")] - partial class Invites + [Migration("20260917183831_Init")] + partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.HasAnnotation("ProductVersion", "10.0.12"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Name") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("NormalizedName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -55,19 +50,17 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("ClaimType") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ClaimValue") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RoleId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -80,19 +73,17 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("ClaimType") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ClaimValue") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("UserId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -104,17 +95,17 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ProviderKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ProviderDisplayName") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("UserId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -126,10 +117,10 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RoleId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -141,16 +132,16 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("LoginProvider") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Value") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -161,14 +152,14 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("IsAccepted") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("TeacherName") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -178,54 +169,54 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b => { b.Property("Id") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("AccessFailedCount") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("EmailConfirmed") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("LockoutEnabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); + .HasColumnType("TEXT"); b.Property("NormalizedEmail") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("NormalizedUserName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("PasswordHash") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PhoneNumber") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("SecurityStamp") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UserName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.HasKey("Id"); diff --git a/web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.cs b/web/StuzkovakWeb/Migrations/20260917183831_Init.cs similarity index 71% rename from web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.cs rename to web/StuzkovakWeb/Migrations/20260917183831_Init.cs index 462b736..7c2b827 100644 --- a/web/StuzkovakWeb/Migrations/20260501160159_SwitchToIdentity.cs +++ b/web/StuzkovakWeb/Migrations/20260917183831_Init.cs @@ -1,13 +1,12 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace StuzkovakWeb.Migrations { /// - public partial class SwitchToIdentity : Migration + public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -16,10 +15,10 @@ namespace StuzkovakWeb.Migrations name: "AspNetRoles", columns: table => new { - Id = table.Column(type: "text", nullable: false), - Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "text", nullable: true) + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -30,36 +29,49 @@ namespace StuzkovakWeb.Migrations name: "AspNetUsers", columns: table => new { - Id = table.Column(type: "text", nullable: false), - UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "boolean", nullable: false), - PasswordHash = table.Column(type: "text", nullable: true), - SecurityStamp = table.Column(type: "text", nullable: true), - ConcurrencyStamp = table.Column(type: "text", nullable: true), - PhoneNumber = table.Column(type: "text", nullable: true), - PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), - TwoFactorEnabled = table.Column(type: "boolean", nullable: false), - LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), - LockoutEnabled = table.Column(type: "boolean", nullable: false), - AccessFailedCount = table.Column(type: "integer", nullable: false) + Id = table.Column(type: "TEXT", nullable: false), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Invites", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + TeacherName = table.Column(type: "TEXT", nullable: false), + IsAccepted = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Invites", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AspNetRoleClaims", columns: table => new { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(type: "text", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(type: "text", nullable: true) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -76,11 +88,11 @@ namespace StuzkovakWeb.Migrations name: "AspNetUserClaims", columns: table => new { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "text", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(type: "text", nullable: true) + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -97,10 +109,10 @@ namespace StuzkovakWeb.Migrations name: "AspNetUserLogins", columns: table => new { - LoginProvider = table.Column(type: "text", nullable: false), - ProviderKey = table.Column(type: "text", nullable: false), - ProviderDisplayName = table.Column(type: "text", nullable: true), - UserId = table.Column(type: "text", nullable: false) + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -117,8 +129,8 @@ namespace StuzkovakWeb.Migrations name: "AspNetUserRoles", columns: table => new { - UserId = table.Column(type: "text", nullable: false), - RoleId = table.Column(type: "text", nullable: false) + UserId = table.Column(type: "TEXT", nullable: false), + RoleId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -141,10 +153,10 @@ namespace StuzkovakWeb.Migrations name: "AspNetUserTokens", columns: table => new { - UserId = table.Column(type: "text", nullable: false), - LoginProvider = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false), - Value = table.Column(type: "text", nullable: true) + UserId = table.Column(type: "TEXT", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) }, constraints: table => { @@ -213,6 +225,9 @@ namespace StuzkovakWeb.Migrations migrationBuilder.DropTable( name: "AspNetUserTokens"); + migrationBuilder.DropTable( + name: "Invites"); + migrationBuilder.DropTable( name: "AspNetRoles"); diff --git a/web/StuzkovakWeb/Migrations/AppDbContextModelSnapshot.cs b/web/StuzkovakWeb/Migrations/AppDbContextModelSnapshot.cs index 219ddf1..aed51f8 100644 --- a/web/StuzkovakWeb/Migrations/AppDbContextModelSnapshot.cs +++ b/web/StuzkovakWeb/Migrations/AppDbContextModelSnapshot.cs @@ -3,7 +3,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using StuzkovakWeb.Data; #nullable disable @@ -16,28 +15,24 @@ namespace StuzkovakWeb.Migrations protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.6") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.HasAnnotation("ProductVersion", "10.0.12"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Name") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("NormalizedName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -52,19 +47,17 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("ClaimType") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ClaimValue") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RoleId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -77,19 +70,17 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + .HasColumnType("INTEGER"); b.Property("ClaimType") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ClaimValue") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("UserId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -101,17 +92,17 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ProviderKey") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("ProviderDisplayName") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("UserId") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -123,10 +114,10 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("RoleId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -138,16 +129,16 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("LoginProvider") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Name") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Value") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -158,14 +149,14 @@ namespace StuzkovakWeb.Migrations { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("uuid"); + .HasColumnType("TEXT"); b.Property("IsAccepted") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("TeacherName") .IsRequired() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -175,54 +166,54 @@ namespace StuzkovakWeb.Migrations modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b => { b.Property("Id") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("AccessFailedCount") - .HasColumnType("integer"); + .HasColumnType("INTEGER"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("EmailConfirmed") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("LockoutEnabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); + .HasColumnType("TEXT"); b.Property("NormalizedEmail") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("NormalizedUserName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.Property("PasswordHash") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PhoneNumber") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("SecurityStamp") - .HasColumnType("text"); + .HasColumnType("TEXT"); b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); + .HasColumnType("INTEGER"); b.Property("UserName") .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasColumnType("TEXT"); b.HasKey("Id"); diff --git a/web/StuzkovakWeb/Program.cs b/web/StuzkovakWeb/Program.cs index 52e8a7c..8200ee0 100644 --- a/web/StuzkovakWeb/Program.cs +++ b/web/StuzkovakWeb/Program.cs @@ -13,12 +13,9 @@ public class Program DotEnv.Load(); var builder = WebApplication.CreateBuilder(args); - // gets the connection string from configuration - var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") - ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); - builder.Services.AddDbContext(options => - options.UseNpgsql(connectionString)); + options.UseSqlite( + builder.Configuration.GetConnectionString("DefaultConnection"))); builder.Services.AddControllersWithViews(); diff --git a/web/StuzkovakWeb/StuzkovakWeb.csproj b/web/StuzkovakWeb/StuzkovakWeb.csproj index 30e6630..a884b98 100644 --- a/web/StuzkovakWeb/StuzkovakWeb.csproj +++ b/web/StuzkovakWeb/StuzkovakWeb.csproj @@ -8,13 +8,13 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/web/StuzkovakWeb/appsettings.json b/web/StuzkovakWeb/appsettings.json index 75c84b0..47d92c3 100644 --- a/web/StuzkovakWeb/appsettings.json +++ b/web/StuzkovakWeb/appsettings.json @@ -7,7 +7,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Database=templatedb;Username=user;Password=password" + "DefaultConnection": "Data Source=app.db" }, "Identity": { "Password": { diff --git a/web/docker-compose.yaml b/web/docker-compose.yaml index 2f878eb..95ceb25 100644 --- a/web/docker-compose.yaml +++ b/web/docker-compose.yaml @@ -1,26 +1,14 @@ services: - db: - image: postgres:latest - container_name: template_db - environment: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: templatedb - ports: - - "5432:5432" - volumes: - - postgres_data:/var/lib/postgresql/data - templateweb: build: context: . dockerfile: TemplateWeb/Dockerfile environment: - ConnectionStrings__DefaultConnection: "Host=db;Database=templatedb;Username=user;Password=password" - depends_on: - - db + - ConnectionStrings__DefaultConnection=Data Source=/app/data/app.db + volumes: + - sqlite_data:/app/data ports: - "8080:8080" volumes: - postgres_data: \ No newline at end of file + sqlite_data: \ No newline at end of file