< Summary

Line coverage
86%
Covered lines: 159
Uncovered lines: 25
Coverable lines: 184
Total lines: 244
Line coverage: 86.4%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: .ctor(...)100%11100%
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.PostgreSql/Migrations/Identity/20241212211900_V3_3.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace Elsa.Persistence.EFCore.PostgreSql.Migrations.Identity
 6{
 7    /// <inheritdoc />
 8    public partial class V3_3 : Migration
 9    {
 10        private readonly Elsa.Persistence.EFCore.IElsaDbContextSchema _schema;
 11
 12        /// <inheritdoc />
 213        public V3_3(Elsa.Persistence.EFCore.IElsaDbContextSchema schema)
 14        {
 215            _schema = schema;
 216        }
 17
 18        /// <inheritdoc />
 19        protected override void Up(MigrationBuilder migrationBuilder)
 20        {
 221            migrationBuilder.AddColumn<string>(
 222                name: "TenantId",
 223                schema: _schema.Schema,
 224                table: "Users",
 225                type: "text",
 226                nullable: true);
 27
 228            migrationBuilder.AddColumn<string>(
 229                name: "TenantId",
 230                schema: _schema.Schema,
 231                table: "Roles",
 232                type: "text",
 233                nullable: true);
 34
 235            migrationBuilder.AddColumn<string>(
 236                name: "TenantId",
 237                schema: _schema.Schema,
 238                table: "Applications",
 239                type: "text",
 240                nullable: true);
 41
 242            migrationBuilder.CreateIndex(
 243                name: "IX_User_TenantId",
 244                schema: _schema.Schema,
 245                table: "Users",
 246                column: "TenantId");
 47
 248            migrationBuilder.CreateIndex(
 249                name: "IX_Role_TenantId",
 250                schema: _schema.Schema,
 251                table: "Roles",
 252                column: "TenantId");
 53
 254            migrationBuilder.CreateIndex(
 255                name: "IX_Application_TenantId",
 256                schema: _schema.Schema,
 257                table: "Applications",
 258                column: "TenantId");
 259        }
 60
 61        /// <inheritdoc />
 62        protected override void Down(MigrationBuilder migrationBuilder)
 63        {
 064            migrationBuilder.DropIndex(
 065                name: "IX_User_TenantId",
 066                schema: _schema.Schema,
 067                table: "Users");
 68
 069            migrationBuilder.DropIndex(
 070                name: "IX_Role_TenantId",
 071                schema: _schema.Schema,
 072                table: "Roles");
 73
 074            migrationBuilder.DropIndex(
 075                name: "IX_Application_TenantId",
 076                schema: _schema.Schema,
 077                table: "Applications");
 78
 079            migrationBuilder.DropColumn(
 080                name: "TenantId",
 081                schema: _schema.Schema,
 082                table: "Users");
 83
 084            migrationBuilder.DropColumn(
 085                name: "TenantId",
 086                schema: _schema.Schema,
 087                table: "Roles");
 88
 089            migrationBuilder.DropColumn(
 090                name: "TenantId",
 091                schema: _schema.Schema,
 092                table: "Applications");
 093        }
 94    }
 95}

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore.PostgreSql/Migrations/Identity/20241212211900_V3_3.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("20241212211900_V3_3")]
 15    partial class V3_3
 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.20")
 124                .HasAnnotation("Relational:MaxIdentifierLength", 63);
 25
 126            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 27
 128            modelBuilder.Entity("Elsa.Identity.Entities.Application", b =>
 129                {
 130                    b.Property<string>("Id")
 131                        .HasColumnType("text");
 132
 133                    b.Property<string>("ClientId")
 134                        .IsRequired()
 135                        .HasColumnType("text");
 136
 137                    b.Property<string>("HashedApiKey")
 138                        .IsRequired()
 139                        .HasColumnType("text");
 140
 141                    b.Property<string>("HashedApiKeySalt")
 142                        .IsRequired()
 143                        .HasColumnType("text");
 144
 145                    b.Property<string>("HashedClientSecret")
 146                        .IsRequired()
 147                        .HasColumnType("text");
 148
 149                    b.Property<string>("HashedClientSecretSalt")
 150                        .IsRequired()
 151                        .HasColumnType("text");
 152
 153                    b.Property<string>("Name")
 154                        .IsRequired()
 155                        .HasColumnType("text");
 156
 157                    b.Property<string>("Roles")
 158                        .IsRequired()
 159                        .HasColumnType("text")
 160                        .HasColumnName("Roles");
 161
 162                    b.Property<string>("TenantId")
 163                        .HasColumnType("text");
 164
 165                    b.HasKey("Id");
 166
 167                    b.HasIndex("ClientId")
 168                        .IsUnique()
 169                        .HasDatabaseName("IX_Application_ClientId");
 170
 171                    b.HasIndex("Name")
 172                        .IsUnique()
 173                        .HasDatabaseName("IX_Application_Name");
 174
 175                    b.HasIndex("TenantId")
 176                        .HasDatabaseName("IX_Application_TenantId");
 177
 178                    b.ToTable("Applications", "Elsa");
 279                });
 80
 181            modelBuilder.Entity("Elsa.Identity.Entities.Role", b =>
 182                {
 183                    b.Property<string>("Id")
 184                        .HasColumnType("text");
 185
 186                    b.Property<string>("Name")
 187                        .IsRequired()
 188                        .HasColumnType("text");
 189
 190                    b.Property<string>("Permissions")
 191                        .IsRequired()
 192                        .HasColumnType("text")
 193                        .HasColumnName("Permissions");
 194
 195                    b.Property<string>("TenantId")
 196                        .HasColumnType("text");
 197
 198                    b.HasKey("Id");
 199
 1100                    b.HasIndex("Name")
 1101                        .IsUnique()
 1102                        .HasDatabaseName("IX_Role_Name");
 1103
 1104                    b.HasIndex("TenantId")
 1105                        .HasDatabaseName("IX_Role_TenantId");
 1106
 1107                    b.ToTable("Roles", "Elsa");
 2108                });
 109
 1110            modelBuilder.Entity("Elsa.Identity.Entities.User", b =>
 1111                {
 1112                    b.Property<string>("Id")
 1113                        .HasColumnType("text");
 1114
 1115                    b.Property<string>("HashedPassword")
 1116                        .IsRequired()
 1117                        .HasColumnType("text");
 1118
 1119                    b.Property<string>("HashedPasswordSalt")
 1120                        .IsRequired()
 1121                        .HasColumnType("text");
 1122
 1123                    b.Property<string>("Name")
 1124                        .IsRequired()
 1125                        .HasColumnType("text");
 1126
 1127                    b.Property<string>("Roles")
 1128                        .IsRequired()
 1129                        .HasColumnType("text")
 1130                        .HasColumnName("Roles");
 1131
 1132                    b.Property<string>("TenantId")
 1133                        .HasColumnType("text");
 1134
 1135                    b.HasKey("Id");
 1136
 1137                    b.HasIndex("Name")
 1138                        .IsUnique()
 1139                        .HasDatabaseName("IX_User_Name");
 1140
 1141                    b.HasIndex("TenantId")
 1142                        .HasDatabaseName("IX_User_TenantId");
 1143
 1144                    b.ToTable("Users", "Elsa");
 2145                });
 146#pragma warning restore 612, 618
 1147        }
 148    }
 149}