Skip to content

powersync-ja/powersync-sqlite-core

Folders and files

NameName
Last commit message
Last commit date
Oct 8, 2024
Apr 24, 2025
Apr 28, 2025
Apr 28, 2025
Apr 28, 2025
Mar 26, 2025
Apr 9, 2025
Apr 28, 2025
Oct 10, 2024
Aug 29, 2023
Oct 14, 2024
Apr 9, 2025
Apr 28, 2025
Apr 28, 2025
Sep 21, 2023
Sep 21, 2023
Oct 21, 2024
Oct 14, 2024
Feb 8, 2024
Apr 28, 2025
Jun 6, 2024

Repository files navigation

PowerSync SQLite Extension

This extension is used by PowerSync client SDKs.

The APIs here not currently stable, and may change in any release. The APIs are intended to be used by PowerSync SDKs only.

API

Primary APIs:

-- Load the extension
-- Sets up functions and views, but does not touch the database itself.
.load powersync

-- Configure the schemas.
-- Creates data tables, indexes and views.
SELECT powersync_replace_schema('{"tables": [{"name": "test", "columns": [{"name": "name", "type": "text"}]}]}');

Other APIs:

-- Initialize the extension data (creates internal tables).
-- Optional - also called as part of powersync_replace_schema().
-- Only useful to ensure internal tables are configured without touching the schema.
SELECT powersync_init();

Building and running

Initialize submodules recursively

git submodule update --init --recursive
# Build the shell
cargo build -p powersync_sqlite
./target/debug/powersync_sqlite test.db "select powersync_rs_version()"

# Build the loadable extension
cargo build -p powersync_loadable
sqlite3 ":memory:" ".load ./target/debug/libpowersync" "select powersync_rs_version()" #This requires sqlite3 installed

# Build the release loadable extension
cargo build -p powersync_loadable --release

# Build for iOS
./tool/build_xcframework.sh

Acknowledgements

Structure of the SQLite extension using Rust is inspired by cr-sqlite.