Migration vers postgres
All checks were successful
Main Build Process / generate documentation (pull_request) Successful in 16s
Main Build Process / generate documentation (push) Successful in 18s

- suppression de sqlite
- ajout de postgres
This commit was merged in pull request #7.
This commit is contained in:
2024-09-05 23:45:05 +02:00
committed by Andre Plourde
parent 284c58188e
commit ac2b6b2c81
12 changed files with 220 additions and 132 deletions

5
.gitignore vendored
View File

@@ -16,4 +16,7 @@ bin
obj obj
report report
tools/ tools/
TestResults TestResults
#docker data
/docker-dev/data

View File

@@ -0,0 +1,23 @@
=== Prérequis
* DotNet 8
* Docker (26.0.2 minimum recommandé)
* Docker Compose (2.26.1 minimum recommandé)
=== Cloner le dépot
=== Lancer les containers
[,sh]
----
docker compose -f .\docker-dev\compose.yml -p ludik-zone up -d
----
=== Migrer la bdd
Lors de la migration de la BDD, les données de connections seront celles du *appsettings.Development.json*
[,sh]
----
dotnet ef database update --project .\src\LudikZoneBlazor\LudikZoneBlazor.csproj
----

View File

@@ -1 +1,26 @@
Hello world = Ludik zone documentation (DEX)
:source-highlighter: pygments
:source-language: bash
:doctype: book
:source-highlighter: rouge
:toc: macro
:toc-title: Table des matières
toc::[]
== Présentation
Le projet Ludik zone est un projet open source ayant comme objectif de créer un portait hébergeant différent jeux en tour par tour.
== Instalation du poste de dev
include::documentation_technique/installation-poste.adoc[]
== Architecture du projet
include::documentation_technique/architecture-projet.adoc[]
== Developpement et livraison
include::documentation_technique/developpement-livraison.adoc[]

Binary file not shown.

View File

@@ -15,10 +15,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.*" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.*" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.*" />
<PackageReference Include="MudBlazor" Version="7.*" /> <PackageReference Include="MudBlazor" Version="7.*" />
<PackageReference Include="Extensions.MudBlazor.StaticInput" Version="2.*" /> <PackageReference Include="Extensions.MudBlazor.StaticInput" Version="2.*" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.*" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,76 +1,81 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using LudikZoneBlazor.Data; using LudikZoneBlazor.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace LudikZoneBlazor.Migrations namespace LudikZoneBlazor.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("00000000000000_CreateIdentitySchema")] [Migration("20240906111336_Init")]
partial class CreateIdentitySchema partial class Init
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LudikZoneBlazor.Data.ApplicationUser", b => modelBuilder.Entity("LudikZoneBlazor.Data.ApplicationUser", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER"); .HasColumnType("integer");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd") b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("PasswordHash") b.Property<string>("PasswordHash")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed") b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<bool>("TwoFactorEnabled") b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
@@ -87,19 +92,19 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
@@ -114,17 +119,19 @@ namespace LudikZoneBlazor.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -137,17 +144,19 @@ namespace LudikZoneBlazor.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -159,17 +168,17 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@@ -181,10 +190,10 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@@ -196,16 +205,16 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@@ -1,12 +1,13 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
namespace LudikZoneBlazor.Migrations namespace LudikZoneBlazor.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class CreateIdentitySchema : Migration public partial class Init : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@@ -15,10 +16,10 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetRoles", name: "AspNetRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(type: "TEXT", nullable: false), Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true) ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -29,21 +30,21 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetUsers", name: "AspNetUsers",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(type: "TEXT", nullable: false), Id = table.Column<string>(type: "text", nullable: false),
UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true), NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false), EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(type: "TEXT", nullable: true), PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(type: "TEXT", nullable: true), SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true), ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "TEXT", nullable: true), PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "INTEGER", nullable: false), PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "INTEGER", nullable: false), TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "TEXT", nullable: true), LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "INTEGER", nullable: false), LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "INTEGER", nullable: false) AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -54,11 +55,11 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetRoleClaims", name: "AspNetRoleClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(type: "TEXT", nullable: false), RoleId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "TEXT", nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "TEXT", nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -75,11 +76,11 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetUserClaims", name: "AspNetUserClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(type: "TEXT", nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "TEXT", nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "TEXT", nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@@ -96,10 +97,10 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetUserLogins", name: "AspNetUserLogins",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(type: "TEXT", nullable: false), LoginProvider = table.Column<string>(type: "text", nullable: false),
ProviderKey = table.Column<string>(type: "TEXT", nullable: false), ProviderKey = table.Column<string>(type: "text", nullable: false),
ProviderDisplayName = table.Column<string>(type: "TEXT", nullable: true), ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<string>(type: "TEXT", nullable: false) UserId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -116,8 +117,8 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetUserRoles", name: "AspNetUserRoles",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(type: "TEXT", nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
RoleId = table.Column<string>(type: "TEXT", nullable: false) RoleId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@@ -140,10 +141,10 @@ namespace LudikZoneBlazor.Migrations
name: "AspNetUserTokens", name: "AspNetUserTokens",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(type: "TEXT", nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
LoginProvider = table.Column<string>(type: "TEXT", nullable: false), LoginProvider = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false), Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "TEXT", nullable: true) Value = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {

View File

@@ -1,9 +1,10 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using LudikZoneBlazor.Data; using LudikZoneBlazor.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable #nullable disable
@@ -15,59 +16,63 @@ namespace LudikZoneBlazor.Migrations
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LudikZoneBlazor.Data.ApplicationUser", b => modelBuilder.Entity("LudikZoneBlazor.Data.ApplicationUser", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<int>("AccessFailedCount") b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER"); .HasColumnType("integer");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd") b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("PasswordHash") b.Property<string>("PasswordHash")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed") b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<string>("SecurityStamp") b.Property<string>("SecurityStamp")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<bool>("TwoFactorEnabled") b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
@@ -84,19 +89,19 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT"); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
@@ -111,17 +116,19 @@ namespace LudikZoneBlazor.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -134,17 +141,19 @@ namespace LudikZoneBlazor.Migrations
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType") b.Property<string>("ClaimType")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ClaimValue") b.Property<string>("ClaimValue")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -156,17 +165,17 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey"); b.HasKey("LoginProvider", "ProviderKey");
@@ -178,10 +187,10 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("RoleId") b.Property<string>("RoleId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("UserId", "RoleId"); b.HasKey("UserId", "RoleId");
@@ -193,16 +202,16 @@ namespace LudikZoneBlazor.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{ {
b.Property<string>("UserId") b.Property<string>("UserId")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT"); .HasColumnType("text");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("TEXT"); .HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name"); b.HasKey("UserId", "LoginProvider", "Name");

View File

@@ -5,6 +5,7 @@ using MudBlazor.Services;
using LudikZoneBlazor.Components; using LudikZoneBlazor.Components;
using LudikZoneBlazor.Components.Account; using LudikZoneBlazor.Components.Account;
using LudikZoneBlazor.Data; using LudikZoneBlazor.Data;
using Npgsql;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@@ -27,11 +28,20 @@ builder.Services.AddAuthentication(options =>
}) })
.AddIdentityCookies(); .AddIdentityCookies();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); #region Base de données
NpgsqlConnectionStringBuilder conStrBuilder = new NpgsqlConnectionStringBuilder(builder.Configuration.GetConnectionString("DefaultConnection"));
conStrBuilder.Host = string.IsNullOrEmpty(builder.Configuration["DB_HOST"]) ? conStrBuilder.Host : builder.Configuration["DB_HOST"];
conStrBuilder.Username = string.IsNullOrEmpty(builder.Configuration["DB_USER"]) ? conStrBuilder.Username : builder.Configuration["DB_USER"];
conStrBuilder.Database = string.IsNullOrEmpty(builder.Configuration["DB_DATABASE"]) ? conStrBuilder.Database : builder.Configuration["DB_DATABASE"];
conStrBuilder.Port = int.TryParse(builder.Configuration["DB_PORT"], out int tempVal) ? tempVal : conStrBuilder.Port;
conStrBuilder.Password = builder.Configuration["DB_PASSWORD"];
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(connectionString)); options.UseNpgsql(conStrBuilder.ToString()));
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddDatabaseDeveloperPageExceptionFilter();
#endregion
builder.Services.AddIdentityCore<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) builder.Services.AddIdentityCore<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>() .AddEntityFrameworkStores<ApplicationDbContext>()
.AddSignInManager() .AddSignInManager()

View File

@@ -1,8 +1,16 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
} },
} "ConnectionStrings": {
"DefaultConnection": "host=localhost;username=admin;database=ludikZone;Pooling=false;Timeout=300;CommandTimeout=300;Port=5432;"
},
"DB_HOST": "localhost",
"DB_PORT": 5432,
"DB_USER": "admin",
"DB_PASSWORD": "admin",
"DB_DATABASE": "ludikZone"
}