This repository contains scripts to export and import Appwrite database schemas and data.
β Export and import Appwrite database schema
β Backup and restore database records
β Automated scripts using Node.js
- Install Dependencies
npm install node-appwrite --save
- Export Database Schema
node export-schema.js
- Import Database Schema
node import-schema.js
- Export Data
node export-data.js
- Import Data
node import-data.js
Before running the scripts, update your Appwrite API credentials inside the JavaScript files.
You need to replace the placeholders with your actual Appwrite credentials in the scripts:
const client = new sdk.Client()
.setEndpoint('http://your-appwrite-server/v1') // πΉ Your Appwrite server URL
.setProject('your_project_id') // πΉ Replace with your Appwrite project ID
.setKey('your_api_key'); // πΉ Replace with your Appwrite API Key
const databaseId = 'your_database_id'; // πΉ Replace with your Database ID
const collectionId = 'your_collection_id'; // πΉ Replace with your Collection ID
Additionally, some scripts require further modifications, including:
- JSON file paths (e.g., for backups and imports)
- targetCollectionId (e.g., if importing into a different collection)
- backupDatabaseId (e.g., if backing up to a different database) ......
β¨ These additional configurations are explained in the respective JavaScript files as comments.
π Before running any script, check the file and modify these values accordingly.