Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to select sub-factions #86

Open
DevJonny opened this issue Mar 20, 2020 · 9 comments
Open

Ability to select sub-factions #86

DevJonny opened this issue Mar 20, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@DevJonny
Copy link
Contributor

Describe the solution you'd like
I want to be able to select the sub-factions introduced in the Elites book

Describe alternatives you've considered
Battlescribe ;)

@DevJonny DevJonny added the enhancement New feature or request label Mar 20, 2020
@sklarsa
Copy link
Contributor

sklarsa commented Jul 21, 2020

I'll take a look at this

@sklarsa
Copy link
Contributor

sklarsa commented Jul 22, 2020

@DevJonny how are we handling ADD FOREIGN KEY operations? Specifically adding SubFactionId to the Members table...

System.NotSupportedException: SQLite does not support this migration operation ('AddForeignKeyOperation'). For more information, see http://go.microsoft.com/fwlink/?LinkId=723262.
  at Microsoft.EntityFrameworkCore.Migrations.SqliteMigrationsSqlGenerator.Generate (Microsoft.EntityFrameworkCore.Migrations.Operations.AddForeignKeyOperation operation, Microsoft.EntityFrameworkCore.Metadata.IModel model, Microsoft.EntityFrameworkCore.Migrations.MigrationCommandListBuilder builder) [0x00010] in <6fac96ba37a44740bc51ba823588ec81>:0
  at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator+<>c.<.cctor>b__72_1 (Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator g, Microsoft.EntityFrameworkCore.Migrations.Operations.MigrationOperation o, Microsoft.EntityFrameworkCore.Metadata.IModel m, Microsoft.EntityFrameworkCore.Migrations.MigrationCommandListBuilder b) [0x00000] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate (Microsoft.EntityFrameworkCore.Migrations.Operations.MigrationOperation operation, Microsoft.EntityFrameworkCore.Metadata.IModel model, Microsoft.EntityFrameworkCore.Migrations.MigrationCommandListBuilder builder) [0x00045] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate (System.Collections.Generic.IReadOnlyList`1[T] operations, Microsoft.EntityFrameworkCore.Metadata.IModel model) [0x0002d] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.Migrations.SqliteMigrationsSqlGenerator.Generate (System.Collections.Generic.IReadOnlyList`1[T] operations, Microsoft.EntityFrameworkCore.Metadata.IModel model) [0x00007] in <6fac96ba37a44740bc51ba823588ec81>:0
  at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql (Microsoft.EntityFrameworkCore.Migrations.Migration migration) [0x00045] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator+<>c__DisplayClass13_2.<GetMigrationCommandLists>b__2 () [0x00026] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate (System.String targetMigration) [0x0007a] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate (Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade) [0x00010] in <1b06b8e99d984506b89b3e4ae11831eb>:0
  at KillTeam.Services.KTUserContext..ctor (System.String dbpath) [0x00009] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/Services/KTUserContext.cs:16
  at KillTeam.Services.DBUpdater..ctor (System.String dbpath, KillTeam.Services.RulesProviders.RulesProvider provider, System.EventHandler`1[TEventArgs] callback) [0x00028] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/Services/DBUpdater.cs:43
  at KillTeam.Services.KTContext+<>c.<.cctor>b__6_0 () [0x00000] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/Services/KTContext.cs:23
  at System.Lazy`1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x00043] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:333
  at System.Lazy`1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) [0x00022] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:351
  at System.Lazy`1[T].CreateValue () [0x00074] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:431
  at System.Lazy`1[T].get_Value () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:509
  at KillTeam.Services.KTContext.get_Db () [0x00000] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/Services/KTContext.cs:16
  at KillTeam.ViewModels.DatabaseLoadViewModel.UpdateDB () [0x00013] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/ViewModels/DatabaseLoadViewModel.cs:28
  at KillTeam.ViewModels.DatabaseLoadViewModel.<StartUpdate>b__4_0 (System.Object _o) [0x00000] in /Users/steven/source/KTManager/KTManagerApp/KillTeam/ViewModels/DatabaseLoadViewModel.cs:22
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000d] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1370
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1341
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:899
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1261

@DevJonny
Copy link
Contributor Author

@sklarsa I think the only way to add a new Foreign Key with SQLite is by adding the actual SQL as an operation in the migration file. Basically you have to create a new table (with the new FK), copy across the data, and drop the old table according to this KB article.

I wish we weren't using a relational DB for this, but that's what we're stuck with for now.

@sklarsa
Copy link
Contributor

sklarsa commented Jul 23, 2020

@DevJonny Do you have a copy of the SQLite database that you can send over? Android device monitor is crashing whenever I open it, so I can't get to my emulator's filesystem

@DevJonny
Copy link
Contributor Author

@sklarsa I'll see if I can get one this evening.

@DevJonny
Copy link
Contributor Author

Databases.zip

@sklarsa
Copy link
Contributor

sklarsa commented Jul 26, 2020

Thanks! I started working on a raw sql script to execute during migrations, but it was painful to write. Maybe I'll try something along these lines next, dotnet/efcore#329 (comment)

@DevJonny
Copy link
Contributor Author

Yeah that looks like a good shout 👍

@sklarsa
Copy link
Contributor

sklarsa commented Jul 30, 2020

I'm going to split this up into a few PRs

  1. Adds subfaction-related models and tables
  2. Populate the subfaction database (in KTRules)
  3. Create a UI component for editing team member subfactions

The first PR is ready #131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants