Skip to content

feat: Initial fork and patching of sql.js #1

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

Chriztiaan
Copy link
Collaborator

@Chriztiaan Chriztiaan commented Jul 11, 2025

This adds everything needed to maintain our fork of sql.js. This variant includes Powersync (made possible by the git patch files). To be used in the @powersync/dev-adapter package introduced by powersync-ja/powersync-js#647.

Why?

Considering that there are already production ready adapters for web, React Native (two in fact), and Node it might not be immediately clear why we need this. Those adapters are recommended for production. But this dev-adapter needs less setup, as it runs completely in JS. This simplifies the setup which is great for trying out PowerSync.
This also works with Expo Go because we don't need to do build config as it's already running in JS.

@Chriztiaan Chriztiaan marked this pull request as ready for review July 11, 2025 14:37
@Chriztiaan Chriztiaan changed the title Initial fork feat: Initial fork and patching of sql.js Jul 11, 2025
@Chriztiaan Chriztiaan requested a review from simolus3 July 11, 2025 14:48
Copy link

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks neat 👍

set -e

SQLITE_VERSION="2.7.6"
POWERSYNC_CORE_VERSION="0.4.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just make that 0.4.2 right away :D

rm -rf $SQLITE_PATH
fi

git clone --depth 1 https://github.com/sql-js/sql.js.git $SQLITE_PATH

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably clone a fixed revision to ensure we can always run the script and update the core extension even when there are changes from sql.js? Otherwise there's a risk that they break the patches (which we'd have to fix either way, but it'd be nice for this to be reproducible).

-"_sqlite3_result_error",
-"_sqlite3_aggregate_context",
-"_RegisterExtensionFunctions",
-"_sqlite3_update_hook"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own understanding: It looks like there was support for update hooks here already, did they not work for us?

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.

2 participants