
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
appwrite-migration
Advanced tools
A comprehensive utility designed to streamline database migrations within the Appwrite Ecosystem.
Appwrite Migration is a comprehensive utility designed to streamline database migrations within the Appwrite Ecosystem. This library facilitates seamless schema and data transitions, enhancing the ease and predictability of managing different environments.
We strongly recommend reading through the entire README, paying close attention to Setting-up and Recommendations sections!
To install the package, simply follow the below commands:
# using npm
npm install appwrite-migration
# using yarn
yarn add appwrite migration
Before getting started with the documentation you must have a basic knowledge of what Appwrite is and how to integrate in your project. You can have a quick look by clicking on the link here.
After the installation, extract the function createAppwriteMigrationClient from appwrite-migration
import { createAppwriteMigrationClient } from "appwrite-migration";
const appwriteObject = createAppwriteMigrationClient(
endPoint,
projectID,
apiKey
);
The createAppwriteMigrationClient() function accepts 3 parameters:-
The Appwrite Object helps you to access 4 functions so that you can migrate your collections, buckets. The 4 methods are:
Note: support for function migration is coming soon.
generateSchema() method collects the data from the provided Appwrite account instance and returns the json to store it into the file. Below is the example on how to collect it:
const schema = await appwriteObject.generateSchema();
To save the json into a file, you can follow the below code snippet:
import { writeFileSync } from "fs";
const generateSchemaFile = async () => {
writeFileSync("schema.json", JSON.stringify(schema, null, 2), {
encoding: "utf-8",
});
};
prepareSchema() method prepares the schema of collection and bucket into the appwrite instance that is provided. It accepts parsed json as input that is generated using the help of generateSchema() method.
Note: it generates a fresh schema so note to take backup of your data as it will delete the previous data.
To use this function follow the below command to read the .json file from your local machine
import { readFileSync } from "fs";
export const prepareSchemaFile = () => {
const fileContent = readFileSync("schema.json", { encoding: "utf-8" });
const schema = JSON.parse(fileContent);
return schema;
};
To load the schema file into the function, follow the below command:
let schemaFile = prepareSchemaFile();
await appwriteObject.prepareSchema(schemaFile);
generateData() method collects the data from the provided schema file which is generated using generateSchema() method. This method accepts schema as a parameter and return the documents in the form .json file which can be written in a file.
const schema = await appwriteObject.generateSchema();
const generatedData = await appwriteObject.generateData(schema);
To save the json into a file, you can follow the below code snippet:
import { writeFileSync } from "fs";
const generateDataFile = async () => {
writeFileSync("data.json", JSON.stringify(generatedData, null, 2), {
encoding: "utf-8",
});
};
prepareData() method prepares the data of collection and bucket from .json file to migrate to the server. It accepts parsed json as input that is generated using the help of generateData() method.
Note: this method will help you to migrate the code into a new appwrite instance.
To use this function follow the below command to read the .json file from your local machine
import { readFileSync } from "fs";
export const prepareDataFile = () => {
const fileContents = readFileSync("data.json", { encoding: "utf-8" });
const data: Data = JSON.parse(fileContents);
return data;
};
To load the data file into the function, follow the below command:
let schemaFile = prepareDataFile();
await appwriteObject.prepareData(schemaFile);
apwrite-migration is licensed under the MIT License - see the LICENSE file for details.
This package needs a star️ from you. Don't forget to leave a star 🌟
FAQs
A comprehensive utility designed to streamline database migrations within the Appwrite Ecosystem.
We found that appwrite-migration demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.