Skip to content

Conversation

mugikhan
Copy link
Contributor

@mugikhan mugikhan commented Sep 11, 2024

Description

This work includes the introduction of a OP SQLite factory that can be used when creating a PowerSync database. This will be opt-in by default allowing the user to install an additional dependency in order to use OP SQLite rather than react-native-quick-sqlite. The @op-engineering/op-sqlite dependency can not installed side by side with @journeyapps/react-native-quick-sqlite as the compiled sqlite binaries conflict.

This will allow us to eventually support React Native's new architecture which requires native modules to be upgraded to the newer Turbo module system. OP SQLite supports new architecture by default.

Example

This is how initializing a new PowerSync database currently works and how it will work using the new OP SQLite factory.

RNQS:

this.powersync = new PowerSyncDatabase({ 
    schema: AppSchema,
      database: {
        dbFilename: 'sqlite.db'
      }
});

OP SQLite:

const factory = new OPSqliteOpenFactory({
    dbFilename: 'sqlite.db'
});
this.powersync = new PowerSyncDatabase({ database: factory, schema: AppSchema });

Shoutout to @stevensJourney for laying out majority of the groundwork.

Testing

The package was tested manually in the react-native-supabase-todolist demo.

  • Android (old arch and new arch)
  • iOS (old arch and new arch)

TODO

  • Tests (Will be done in the next release)
  • Native config (iOS and Android)

Copy link

changeset-bot bot commented Sep 11, 2024

🦋 Changeset detected

Latest commit: c698c07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@powersync/op-sqlite Patch
@powersync/react-native Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mugikhan mugikhan marked this pull request as draft September 11, 2024 15:24
stevensJourney
stevensJourney previously approved these changes Oct 10, 2024
@mugikhan mugikhan merged commit 67e17b5 into main Oct 10, 2024
5 checks passed
@mugikhan mugikhan deleted the poc/op-sqlite branch October 10, 2024 15:26
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.

6 participants