Skip to content

Create the table, and keep the database in aware_gyroscope.sqlite - #3

Merged
tetujin merged 2 commits into
masterfrom
fix/create-table
Nov 19, 2026
Merged

tetujin merged 2 commits into
masterfrom
fix/create-table

Conversation

@tetujin

@tetujin tetujin commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Requires core 1.7.1. Merge after awareframework/com.awareframework.ios.core#9 is merged and tagged 1.7.1. Package.swift asks for core from: "1.7.1".

  • Table: the sensor never created its table and set no dbTableName. Without the app creating the table, every save failed and nothing was synced.
    • The sensor now creates the table right after opening its database (initializeTables(), as in the battery sensor).
    • Config sets dbTableName.
  • Database file: the default dbPath was the shared "aware", although the README says "aware_gyroscope". It is now "aware_gyroscope", like the other sensors (Config.defaultDbPath).
    • Rows saved by 1.6.2 or earlier in aware.sqlite and not uploaded yet are moved into the new file at start-up, with SQLiteEngine.moveTable(_:fromDatabaseAt:). They are still uploaded, and rows already uploaded are not sent again.
    • Nothing is moved when there is nothing to move.
    • Nothing is moved when the app sets its own dbPath.

Tests

  • testSensorCreatesItsTable: creating the sensor is enough to save a row and read it back for sync.
  • testRowsInThePreviousDatabaseMove: rows in the old aware.sqlite move to aware_gyroscope.sqlite, and the old table is dropped.
  • All tests pass on the iOS Simulator. Until 1.7.1 is tagged, they were run against the local core branch.

🤖 Generated with Claude Code

tetujin and others added 2 commits November 19, 2026 13:25
The sensor never created its table and had no dbTableName, so without the app
creating the table every save failed and nothing was synced. It now creates
the table after opening its database and sets dbTableName.

The default dbPath was the shared "aware", although the README said
"aware_gyroscope". It is now "aware_gyroscope". Rows saved by 1.6.2 or earlier
in aware.sqlite and not uploaded yet are moved into the new file with
SQLiteEngine.moveTable (core 1.7.1), so they are still uploaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tetujin
tetujin merged commit 38b2def into master Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant