< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 190
Coverable lines: 190
Total lines: 247
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: .ctor(...)0%620%
File 1: Up(...)100%210%
File 1: Down(...)100%210%
File 2: BuildTargetModel(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Migrations/Identity/20231015122250_Initial.cs

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Identity
 7{
 8    /// <inheritdoc />
 9    public partial class Initial : Migration
 10    {
 11        private readonly IElsaDbContextSchema _schema;
 012        public Initial(IElsaDbContextSchema schema)
 13        {
 014            _schema = schema ?? throw new ArgumentNullException(nameof(schema));
 015        }
 16        /// <inheritdoc />
 17        protected override void Up(MigrationBuilder migrationBuilder)
 18        {
 019            migrationBuilder.EnsureSchema(
 020                name: _schema.Schema);
 21
 022            migrationBuilder.CreateTable(
 023                name: "Applications",
 024                schema: _schema.Schema,
 025                columns: table => new
 026                {
 027                    Id = table.Column<string>(type: "text", nullable: false),
 028                    ClientId = table.Column<string>(type: "text", nullable: false),
 029                    HashedClientSecret = table.Column<string>(type: "text", nullable: false),
 030                    HashedClientSecretSalt = table.Column<string>(type: "text", nullable: false),
 031                    Name = table.Column<string>(type: "text", nullable: false),
 032                    HashedApiKey = table.Column<string>(type: "text", nullable: false),
 033                    HashedApiKeySalt = table.Column<string>(type: "text", nullable: false),
 034                    Roles = table.Column<string>(type: "text", nullable: false)
 035                },
 036                constraints: table =>
 037                {
 038                    table.PrimaryKey("PK_Applications", x => x.Id);
 039                });
 40
 041            migrationBuilder.CreateTable(
 042                name: "Roles",
 043                schema: _schema.Schema,
 044                columns: table => new
 045                {
 046                    Id = table.Column<string>(type: "text", nullable: false),
 047                    Name = table.Column<string>(type: "text", nullable: false),
 048                    Permissions = table.Column<string>(type: "text", nullable: false)
 049                },
 050                constraints: table =>
 051                {
 052                    table.PrimaryKey("PK_Roles", x => x.Id);
 053                });
 54
 055            migrationBuilder.CreateTable(
 056                name: "Users",
 057                schema: _schema.Schema,
 058                columns: table => new
 059                {
 060                    Id = table.Column<string>(type: "text", nullable: false),
 061                    Name = table.Column<string>(type: "text", nullable: false),
 062                    HashedPassword = table.Column<string>(type: "text", nullable: false),
 063                    HashedPasswordSalt = table.Column<string>(type: "text", nullable: false),
 064                    Roles = table.Column<string>(type: "text", nullable: false)
 065                },
 066                constraints: table =>
 067                {
 068                    table.PrimaryKey("PK_Users", x => x.Id);
 069                });
 70
 071            migrationBuilder.CreateIndex(
 072                name: "IX_Application_ClientId",
 073                schema: _schema.Schema,
 074                table: "Applications",
 075                column: "ClientId",
 076                unique: true);
 77
 078            migrationBuilder.CreateIndex(
 079                name: "IX_Application_Name",
 080                schema: _schema.Schema,
 081                table: "Applications",
 082                column: "Name",
 083                unique: true);
 84
 085            migrationBuilder.CreateIndex(
 086                name: "IX_Role_Name",
 087                schema: _schema.Schema,
 088                table: "Roles",
 089                column: "Name",
 090                unique: true);
 91
 092            migrationBuilder.CreateIndex(
 093                name: "IX_User_Name",
 094                schema: _schema.Schema,
 095                table: "Users",
 096                column: "Name",
 097                unique: true);
 098        }
 99
 100        /// <inheritdoc />
 101        protected override void Down(MigrationBuilder migrationBuilder)
 102        {
 0103            migrationBuilder.DropTable(
 0104                name: "Applications",
 0105                schema: _schema.Schema);
 106
 0107            migrationBuilder.DropTable(
 0108                name: "Roles",
 0109                schema: _schema.Schema);
 110
 0111            migrationBuilder.DropTable(
 0112                name: "Users",
 0113                schema: _schema.Schema);
 0114        }
 115    }
 116}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Migrations/Identity/20231015122250_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using Elsa.Persistence.EFCore.Modules.Identity;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Migrations;
 6using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 7using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
 8
 9#nullable disable
 10
 11namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Identity
 12{
 13    [DbContext(typeof(IdentityElsaDbContext))]
 14    [Migration("20231015122250_Initial")]
 15    partial class Initial
 16    {
 17        /// <inheritdoc />
 18        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 19        {
 20#pragma warning disable 612, 618
 021            modelBuilder
 022                .HasDefaultSchema("Elsa")
 023                .HasAnnotation("ProductVersion", "7.0.11")
 024                .HasAnnotation("Relational:MaxIdentifierLength", 63);
 25
 026            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 27
 028            modelBuilder.Entity("Elsa.Identity.Entities.Application", b =>
 029                {
 030                    b.Property<string>("Id")
 031                        .HasColumnType("text");
 032
 033                    b.Property<string>("ClientId")
 034                        .IsRequired()
 035                        .HasColumnType("text");
 036
 037                    b.Property<string>("HashedApiKey")
 038                        .IsRequired()
 039                        .HasColumnType("text");
 040
 041                    b.Property<string>("HashedApiKeySalt")
 042                        .IsRequired()
 043                        .HasColumnType("text");
 044
 045                    b.Property<string>("HashedClientSecret")
 046                        .IsRequired()
 047                        .HasColumnType("text");
 048
 049                    b.Property<string>("HashedClientSecretSalt")
 050                        .IsRequired()
 051                        .HasColumnType("text");
 052
 053                    b.Property<string>("Name")
 054                        .IsRequired()
 055                        .HasColumnType("text");
 056
 057                    b.Property<string>("Roles")
 058                        .IsRequired()
 059                        .HasColumnType("text")
 060                        .HasColumnName("Roles");
 061
 062                    b.HasKey("Id");
 063
 064                    b.HasIndex("ClientId")
 065                        .IsUnique()
 066                        .HasDatabaseName("IX_Application_ClientId");
 067
 068                    b.HasIndex("Name")
 069                        .IsUnique()
 070                        .HasDatabaseName("IX_Application_Name");
 071
 072                    b.ToTable("Applications", "Elsa");
 073                });
 74
 075            modelBuilder.Entity("Elsa.Identity.Entities.Role", b =>
 076                {
 077                    b.Property<string>("Id")
 078                        .HasColumnType("text");
 079
 080                    b.Property<string>("Name")
 081                        .IsRequired()
 082                        .HasColumnType("text");
 083
 084                    b.Property<string>("Permissions")
 085                        .IsRequired()
 086                        .HasColumnType("text")
 087                        .HasColumnName("Permissions");
 088
 089                    b.HasKey("Id");
 090
 091                    b.HasIndex("Name")
 092                        .IsUnique()
 093                        .HasDatabaseName("IX_Role_Name");
 094
 095                    b.ToTable("Roles", "Elsa");
 096                });
 97
 098            modelBuilder.Entity("Elsa.Identity.Entities.User", b =>
 099                {
 0100                    b.Property<string>("Id")
 0101                        .HasColumnType("text");
 0102
 0103                    b.Property<string>("HashedPassword")
 0104                        .IsRequired()
 0105                        .HasColumnType("text");
 0106
 0107                    b.Property<string>("HashedPasswordSalt")
 0108                        .IsRequired()
 0109                        .HasColumnType("text");
 0110
 0111                    b.Property<string>("Name")
 0112                        .IsRequired()
 0113                        .HasColumnType("text");
 0114
 0115                    b.Property<string>("Roles")
 0116                        .IsRequired()
 0117                        .HasColumnType("text")
 0118                        .HasColumnName("Roles");
 0119
 0120                    b.HasKey("Id");
 0121
 0122                    b.HasIndex("Name")
 0123                        .IsUnique()
 0124                        .HasDatabaseName("IX_User_Name");
 0125
 0126                    b.ToTable("Users", "Elsa");
 0127                });
 128#pragma warning restore 612, 618
 0129        }
 130    }
 131}