< Summary

Line coverage
94%
Covered lines: 180
Uncovered lines: 10
Coverable lines: 190
Total lines: 247
Line coverage: 94.7%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

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

#LineLine coverage
 1
 2using Microsoft.EntityFrameworkCore.Migrations;
 3
 4#nullable disable
 5
 6namespace Elsa.Persistence.EFCore.SqlServer.Migrations.Identity
 7{
 8    /// <inheritdoc />
 9    public partial class Initial : Migration
 10    {
 11        private readonly IElsaDbContextSchema _schema;
 112        public Initial(IElsaDbContextSchema schema)
 13        {
 114            _schema = schema ?? throw new ArgumentNullException(nameof(schema));
 115        }
 16        /// <inheritdoc />
 17        protected override void Up(MigrationBuilder migrationBuilder)
 18        {
 119            migrationBuilder.EnsureSchema(
 120                name: _schema.Schema);
 21
 122            migrationBuilder.CreateTable(
 123                name: "Applications",
 124                schema: _schema.Schema,
 125                columns: table => new
 126                {
 127                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
 128                    ClientId = table.Column<string>(type: "nvarchar(450)", nullable: false),
 129                    HashedClientSecret = table.Column<string>(type: "nvarchar(max)", nullable: false),
 130                    HashedClientSecretSalt = table.Column<string>(type: "nvarchar(max)", nullable: false),
 131                    Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
 132                    HashedApiKey = table.Column<string>(type: "nvarchar(max)", nullable: false),
 133                    HashedApiKeySalt = table.Column<string>(type: "nvarchar(max)", nullable: false),
 134                    Roles = table.Column<string>(type: "nvarchar(max)", nullable: false)
 135                },
 136                constraints: table =>
 137                {
 138                    table.PrimaryKey("PK_Applications", x => x.Id);
 239                });
 40
 141            migrationBuilder.CreateTable(
 142                name: "Roles",
 143                schema: _schema.Schema,
 144                columns: table => new
 145                {
 146                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
 147                    Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
 148                    Permissions = table.Column<string>(type: "nvarchar(max)", nullable: false)
 149                },
 150                constraints: table =>
 151                {
 152                    table.PrimaryKey("PK_Roles", x => x.Id);
 253                });
 54
 155            migrationBuilder.CreateTable(
 156                name: "Users",
 157                schema: _schema.Schema,
 158                columns: table => new
 159                {
 160                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
 161                    Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
 162                    HashedPassword = table.Column<string>(type: "nvarchar(max)", nullable: false),
 163                    HashedPasswordSalt = table.Column<string>(type: "nvarchar(max)", nullable: false),
 164                    Roles = table.Column<string>(type: "nvarchar(max)", nullable: false)
 165                },
 166                constraints: table =>
 167                {
 168                    table.PrimaryKey("PK_Users", x => x.Id);
 269                });
 70
 171            migrationBuilder.CreateIndex(
 172                name: "IX_Application_ClientId",
 173                schema: _schema.Schema,
 174                table: "Applications",
 175                column: "ClientId",
 176                unique: true);
 77
 178            migrationBuilder.CreateIndex(
 179                name: "IX_Application_Name",
 180                schema: _schema.Schema,
 181                table: "Applications",
 182                column: "Name",
 183                unique: true);
 84
 185            migrationBuilder.CreateIndex(
 186                name: "IX_Role_Name",
 187                schema: _schema.Schema,
 188                table: "Roles",
 189                column: "Name",
 190                unique: true);
 91
 192            migrationBuilder.CreateIndex(
 193                name: "IX_User_Name",
 194                schema: _schema.Schema,
 195                table: "Users",
 196                column: "Name",
 197                unique: true);
 198        }
 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.SqlServer/Migrations/Identity/20231015122242_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using Elsa.Persistence.EFCore.Modules.Identity;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Metadata;
 6using Microsoft.EntityFrameworkCore.Migrations;
 7using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 8
 9#nullable disable
 10
 11namespace Elsa.Persistence.EFCore.SqlServer.Migrations.Identity
 12{
 13    [DbContext(typeof(IdentityElsaDbContext))]
 14    [Migration("20231015122242_Initial")]
 15    partial class Initial
 16    {
 17        /// <inheritdoc />
 18        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 19        {
 20#pragma warning disable 612, 618
 121            modelBuilder
 122                .HasDefaultSchema("Elsa")
 123                .HasAnnotation("ProductVersion", "7.0.11")
 124                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 25
 126            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 27
 128            modelBuilder.Entity("Elsa.Identity.Entities.Application", b =>
 129                {
 130                    b.Property<string>("Id")
 131                        .HasColumnType("nvarchar(450)");
 132
 133                    b.Property<string>("ClientId")
 134                        .IsRequired()
 135                        .HasColumnType("nvarchar(450)");
 136
 137                    b.Property<string>("HashedApiKey")
 138                        .IsRequired()
 139                        .HasColumnType("nvarchar(max)");
 140
 141                    b.Property<string>("HashedApiKeySalt")
 142                        .IsRequired()
 143                        .HasColumnType("nvarchar(max)");
 144
 145                    b.Property<string>("HashedClientSecret")
 146                        .IsRequired()
 147                        .HasColumnType("nvarchar(max)");
 148
 149                    b.Property<string>("HashedClientSecretSalt")
 150                        .IsRequired()
 151                        .HasColumnType("nvarchar(max)");
 152
 153                    b.Property<string>("Name")
 154                        .IsRequired()
 155                        .HasColumnType("nvarchar(450)");
 156
 157                    b.Property<string>("Roles")
 158                        .IsRequired()
 159                        .HasColumnType("nvarchar(max)")
 160                        .HasColumnName("Roles");
 161
 162                    b.HasKey("Id");
 163
 164                    b.HasIndex("ClientId")
 165                        .IsUnique()
 166                        .HasDatabaseName("IX_Application_ClientId");
 167
 168                    b.HasIndex("Name")
 169                        .IsUnique()
 170                        .HasDatabaseName("IX_Application_Name");
 171
 172                    b.ToTable("Applications", "Elsa");
 273                });
 74
 175            modelBuilder.Entity("Elsa.Identity.Entities.Role", b =>
 176                {
 177                    b.Property<string>("Id")
 178                        .HasColumnType("nvarchar(450)");
 179
 180                    b.Property<string>("Name")
 181                        .IsRequired()
 182                        .HasColumnType("nvarchar(450)");
 183
 184                    b.Property<string>("Permissions")
 185                        .IsRequired()
 186                        .HasColumnType("nvarchar(max)")
 187                        .HasColumnName("Permissions");
 188
 189                    b.HasKey("Id");
 190
 191                    b.HasIndex("Name")
 192                        .IsUnique()
 193                        .HasDatabaseName("IX_Role_Name");
 194
 195                    b.ToTable("Roles", "Elsa");
 296                });
 97
 198            modelBuilder.Entity("Elsa.Identity.Entities.User", b =>
 199                {
 1100                    b.Property<string>("Id")
 1101                        .HasColumnType("nvarchar(450)");
 1102
 1103                    b.Property<string>("HashedPassword")
 1104                        .IsRequired()
 1105                        .HasColumnType("nvarchar(max)");
 1106
 1107                    b.Property<string>("HashedPasswordSalt")
 1108                        .IsRequired()
 1109                        .HasColumnType("nvarchar(max)");
 1110
 1111                    b.Property<string>("Name")
 1112                        .IsRequired()
 1113                        .HasColumnType("nvarchar(450)");
 1114
 1115                    b.Property<string>("Roles")
 1116                        .IsRequired()
 1117                        .HasColumnType("nvarchar(max)")
 1118                        .HasColumnName("Roles");
 1119
 1120                    b.HasKey("Id");
 1121
 1122                    b.HasIndex("Name")
 1123                        .IsUnique()
 1124                        .HasDatabaseName("IX_User_Name");
 1125
 1126                    b.ToTable("Users", "Elsa");
 2127                });
 128#pragma warning restore 612, 618
 1129        }
 130    }
 131}