- Potential fix for null ref error
- Add logging around migration
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Dalamud.NET.Sdk/15.0.0">
|
<Project Sdk="Dalamud.NET.Sdk/15.0.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.35.1</Version>
|
<Version>1.35.2</Version>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ internal class MessageStore : IDisposable
|
|||||||
|
|
||||||
private void Migrate0()
|
private void Migrate0()
|
||||||
{
|
{
|
||||||
|
Plugin.Log.Information("Running migration 0: Creating tables");
|
||||||
Connection.Execute(@"
|
Connection.Execute(@"
|
||||||
CREATE TABLE IF NOT EXISTS messages (
|
CREATE TABLE IF NOT EXISTS messages (
|
||||||
Id BLOB PRIMARY KEY NOT NULL, -- Guid
|
Id BLOB PRIMARY KEY NOT NULL, -- Guid
|
||||||
@@ -215,6 +216,7 @@ internal class MessageStore : IDisposable
|
|||||||
|
|
||||||
private void Migrate1()
|
private void Migrate1()
|
||||||
{
|
{
|
||||||
|
Plugin.Log.Information("Running migration 1: Adding Deleted column");
|
||||||
Connection.Execute(@"
|
Connection.Execute(@"
|
||||||
-- Migration 1: Add Deleted column
|
-- Migration 1: Add Deleted column
|
||||||
ALTER TABLE messages ADD COLUMN Deleted BOOLEAN NOT NULL DEFAULT false;
|
ALTER TABLE messages ADD COLUMN Deleted BOOLEAN NOT NULL DEFAULT false;
|
||||||
@@ -225,6 +227,7 @@ internal class MessageStore : IDisposable
|
|||||||
|
|
||||||
private void Migrate2()
|
private void Migrate2()
|
||||||
{
|
{
|
||||||
|
Plugin.Log.Information("Running migration 2: Adding Channel generated column");
|
||||||
Connection.Execute(@"
|
Connection.Execute(@"
|
||||||
-- Migration 2: Add Channel generated column
|
-- Migration 2: Add Channel generated column
|
||||||
ALTER TABLE messages ADD COLUMN Channel INTEGER GENERATED ALWAYS AS (Code & 0x7f) VIRTUAL;
|
ALTER TABLE messages ADD COLUMN Channel INTEGER GENERATED ALWAYS AS (Code & 0x7f) VIRTUAL;
|
||||||
@@ -236,6 +239,7 @@ internal class MessageStore : IDisposable
|
|||||||
|
|
||||||
private void Migrate3()
|
private void Migrate3()
|
||||||
{
|
{
|
||||||
|
Plugin.Log.Information("Running migration 3: Fix log kinds to fit the new format");
|
||||||
Connection.Execute(@"
|
Connection.Execute(@"
|
||||||
-- Migration 3: Fix log kinds to fit the new format
|
-- Migration 3: Fix log kinds to fit the new format
|
||||||
-- Add new ChatType, SourceKind, TargetKind (byte), SortCodeV2
|
-- Add new ChatType, SourceKind, TargetKind (byte), SortCodeV2
|
||||||
@@ -268,6 +272,7 @@ internal class MessageStore : IDisposable
|
|||||||
|
|
||||||
private void SetMigrationVersion(int version)
|
private void SetMigrationVersion(int version)
|
||||||
{
|
{
|
||||||
|
Plugin.Log.Information($"Setting version {version}");
|
||||||
using var cmd = Connection.CreateCommand();
|
using var cmd = Connection.CreateCommand();
|
||||||
// Parameters aren't supported for PRAGMA queries, and you can't set the
|
// Parameters aren't supported for PRAGMA queries, and you can't set the
|
||||||
// version with a pragma_ function.
|
// version with a pragma_ function.
|
||||||
|
|||||||
+2
-2
@@ -131,6 +131,8 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
ExtraChat = new ExtraChat();
|
ExtraChat = new ExtraChat();
|
||||||
FontManager = new FontManager();
|
FontManager = new FontManager();
|
||||||
|
|
||||||
|
MessageManager = new MessageManager(this); // Does it require UI?
|
||||||
|
|
||||||
ChatLogWindow = new ChatLogWindow(this);
|
ChatLogWindow = new ChatLogWindow(this);
|
||||||
SettingsWindow = new SettingsWindow(this);
|
SettingsWindow = new SettingsWindow(this);
|
||||||
DbViewer = new DbViewer(this);
|
DbViewer = new DbViewer(this);
|
||||||
@@ -152,8 +154,6 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
||||||
Interface.UiBuilder.DisableGposeUiHide = true;
|
Interface.UiBuilder.DisableGposeUiHide = true;
|
||||||
|
|
||||||
MessageManager = new MessageManager(this); // requires Ui
|
|
||||||
|
|
||||||
// let all the other components register, then initialize commands
|
// let all the other components register, then initialize commands
|
||||||
Commands.Initialise();
|
Commands.Initialise();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user