Skip to content

πŸ‚ A simple JS script to migrate a local SQLite database to a Turso database on the cloud

License

Notifications You must be signed in to change notification settings

pferreirafabricio/sqlite-2-turso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‚ sqlite-2-turso

A simple JS script to migrate a local SQLite database to a Turso database on the cloud.

license url

πŸ‘€ Overview

Screenshot_10 Screenshot_11

πŸ“– 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 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:
git clone https://github.com/pferreirafabricio/sqlite-2-turso.git
  1. Install the dependencies:
cd sqlite-2-turso
npm install
  1. Configure your environment variables by copying the .env.example file to .env and filling in the necessary details:
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:

npm run migrate

πŸ“ƒ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ‚ A simple JS script to migrate a local SQLite database to a Turso database on the cloud

Topics

Resources

License

Stars

Watchers

Forks