<commit_before><commit_msg>Added missing strongly typed model based modeling.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Lightmap.Core.Tests.Models;
using Lightmap.Modeling;

namespace Lightmap.Core.Tests
{
    public class StronglyTypedMigration : IMigration
    {
        public Task Apply()
        {
            throw new NotImplementedException();
        }

        public void Configure(Lightmap.Modeling2.IDatabaseModeler modeler)
        {
            throw new NotImplementedException();
        }

        public void Configure(DatabaseModeler modeler)
        {
            var rolesTable = modeler.Create().Table<AspNetRoles>()
                .WithPrimaryKey(table => table.Id)
                .GetTable();

            modeler.Create().Table<AspNetRoleClaims>()
                .WithPrimaryKey(table => table.Id)
                .WithForeignKey(rolesTable, (table, referenceTable) => table.RoleId == referenceTable.Id);

            var usersTable = modeler.Create().Table<AspNetUsers>()
                .WithPrimaryKey(table => table.Id)
                .GetTable();

            var userRolesTable = modeler.Create().Table<AspNetUserRoles>()
                .WithForeignKey(rolesTable, (table, referenceTable) => table.RoleId == referenceTable.Id)
                .WithForeignKey(usersTable, (table, referenceTable) => table.UserId == referenceTable.Id);

            modeler.Create().Table<AspNetUserLogins>()
                //.WithClusteredPrimaryKey(table => table.ProviderKey, table => table.LoginProvider)
                .WithForeignKey(usersTable, (table, referenceTable) => table.UserId == referenceTable.Id);

            modeler.Create().Table<AspNetUserClaims>()
                .WithPrimaryKey(table => table.Id)
                .WithForeignKey(usersTable, (table, referenceTable) => table.UserId == referenceTable.Id);
        }

        public Task Rollback()
        {
            throw new NotImplementedException();
        }
    }
}
{'fraction_non_alphanumeric': 0.10822722820763957, 'fraction_numerical': 0.0004897159647404506, 'mean_word_length': 2.388059701492537, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6722065', 'n_tokens_mistral': 534, 'n_tokens_neox': 526, 'n_words': 98}