Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PowerSync/PowerSync.Common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## 0.1.3

- **Breaking:** Made `Table.Name` non-nullable (default ""). This change may affect 0% of users, but it is technically a breaking change.
- Add support for loading custom SQLite extensions via `MDSQLiteOptions.Extensions`.
- Fix streaming sync retry loop reconnecting with no delay after an exception, ignoring `RetryDelayMs`.
- (internal) Remove `Compiled*` classes in favor of working with `Table` and `Schema` objects directly.

## 0.1.2

Expand Down
11 changes: 5 additions & 6 deletions PowerSync/PowerSync.Common/Client/PowerSyncDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public interface IPowerSyncDatabase : ICloseableAsync
public class PowerSyncDatabase : IPowerSyncDatabase
{
public IDBAdapter Database { get; protected set; }
private CompiledSchema schema;
private Schema schema;

private const int DEFAULT_WATCH_THROTTLE_MS = 30;
private static readonly Regex POWERSYNC_TABLE_MATCH = new Regex(@"(^ps_data__|^ps_data_local__)", RegexOptions.Compiled);
Expand Down Expand Up @@ -199,7 +199,7 @@ public PowerSyncDatabase(PowerSyncDatabaseOptions options)
Closed = false;
Ready = false;

schema = options.Schema.Compile();
schema = options.Schema;
SdkVersion = "";

remoteFactory = options.RemoteFactory ?? (connector => new Remote(connector));
Expand Down Expand Up @@ -402,23 +402,22 @@ protected async Task ResolveOfflineSyncStatus()
/// </summary>
public async Task UpdateSchema(Schema schema)
{
CompiledSchema compiledSchema = schema.Compile();
if (syncStreamImplementation != null)
{
throw new Exception("Cannot update schema while connected");
}

try
{
compiledSchema.Validate();
schema.Validate();
}
catch (Exception ex)
{
Logger.LogWarning("Schema validation failed. Unexpected behavior could occur: {Exception}", ex);
}

this.schema = compiledSchema;
await Database.Execute("SELECT powersync_replace_schema(?)", [compiledSchema.ToJSON()]);
this.schema = schema;
await Database.Execute("SELECT powersync_replace_schema(?)", [JsonConvert.SerializeObject(schema)]);
await Database.RefreshSchema();
Events.Emit(new PowerSyncDBEvents.SchemaChangedEvent(schema));
}
Expand Down
37 changes: 0 additions & 37 deletions PowerSync/PowerSync.Common/DB/Schema/ColumnJSON.cs

This file was deleted.

13 changes: 13 additions & 0 deletions PowerSync/PowerSync.Common/DB/Schema/ColumnType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace PowerSync.Common.DB.Schema;

public enum ColumnType
{
Text,
Integer,
Real,
/// <summary>
/// Infers the column type based on the associated property's PropertyType.
/// <b>NB:</b> `ColumnType.Inferred` can only be used when using the <see cref="Attributes" /> syntax.
/// </summary>
Inferred
}
34 changes: 0 additions & 34 deletions PowerSync/PowerSync.Common/DB/Schema/CompiledSchema.cs

This file was deleted.

149 changes: 0 additions & 149 deletions PowerSync/PowerSync.Common/DB/Schema/CompiledTable.cs

This file was deleted.

23 changes: 0 additions & 23 deletions PowerSync/PowerSync.Common/DB/Schema/IndexJSON.cs

This file was deleted.

26 changes: 0 additions & 26 deletions PowerSync/PowerSync.Common/DB/Schema/IndexedColumnJSON.cs

This file was deleted.

Loading
Loading