https://github.com/fabrecostudio/sqlite-2-turso
🐂 A simple JS script to migrate a local SQLite database to a Turso database on the cloud
https://github.com/fabrecostudio/sqlite-2-turso
javascript js migration migration-tool node nodejs sqlite sqlite-database turso turso-db
Last synced: 3 months ago
JSON representation
🐂 A simple JS script to migrate a local SQLite database to a Turso database on the cloud
- Host: GitHub
- URL: https://github.com/fabrecostudio/sqlite-2-turso
- Owner: fabrecostudio
- License: mit
- Created: 2024-07-10T16:32:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-03T13:23:19.000Z (4 months ago)
- Last Synced: 2025-06-24T12:18:42.032Z (4 months ago)
- Topics: javascript, js, migration, migration-tool, node, nodejs, sqlite, sqlite-database, turso, turso-db
- Language: JavaScript
- Homepage:
- Size: 95.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🐂 sqlite-2-turso
A simple JS script to migrate a local SQLite database to a Turso database on the cloud.
## 👀 Overview

## 📖 About
This project provides a straightforward JavaScript utility for migrating data from a local SQLite database to a Turso database hosted in the cloud. It leverages Node.js and a set of dependencies to facilitate the migration process, ensuring a seamless data transition from a local storage mechanism to a scalable, cloud-based solution.
> [!NOTE]
> The migration of tables happens in parallel. If the table was not found on Turso, we used the SQL in the [`database/initial-table-creation.js`](database/initial-table-creation.js) file to create it. If the the row already exists on Turso we update it with the local data.## ✨ Features
- Easy configuration through environment variables.
- Automated migration of tables and data.
- Logging support for monitoring the migration process.
- Utilizes the `@libsql/client` for interacting with the Turso database.
- Supports SQLite3 for local database interactions.## 🏄♂️ Getting Started
### Prerequisites
- Node.js installed on your machine.
- Access to a Turso database instance.### Installation
1. Clone the repository:
```sh
git clone https://github.com/pferreirafabricio/sqlite-2-turso.git
```2. Install the dependencies:
```sh
cd sqlite-2-turso
npm install
```3. Configure your environment variables by copying the .env.example file to .env and filling in the necessary details:
```sh
cp .env.example .env
```### Configuration
The migration script can be configured via environment variables. Here are the variables you can set:
- `SOURCE_DATABASE_PATH`: The path to your local SQLite database file.
- `TURSO_DATABASE_URL`: The URL to your Turso database instance.
- `TURSO_AUTH_TOKEN`: The authentication token for accessing your Turso database.
- `SILENT`: Set to true to reduce logging verbosity.## Usage
To start the migration process, run:
```sh
npm run migrate
```## 📃 License
This project is licensed under the MIT License - see the LICENSE file for details.