@becklyn/caisy-migration
v0.2.2
Published
Use code as single source of truth for your caisy blueprints.
Maintainers
Keywords
Readme
Caisy Migrations
Use code as single source of truth for your caisy blueprints.
Usage
Install this library into your project:
npm i --save @becklyn/caisy-migrationsConfig
Use env variables or a .env or .env.local file to configure the migrations:
| Variable | Description | Default |
| --------------------------- | --------------------------------------- | ----------------------- |
| CAISY_SKIP_MIGRATIONS | Set to true to skip migrations | false |
| CAISY_MIGRATIONS_FILE | Path to the migrations file | ./migrations/index.ts |
| CAISY_PERSONAL_ACCESS_TOKEN | Personal access token for the Caisy API | |
| CAISY_PROJECT_ID | Project ID to use for the migrations | |
Migration script
Create a migration script in the migrations directory (e.g. migrations/index.ts). It should be a TypeScript file that exports a function that takes the Caisy SDK as an argument and returns a promise.
import { CaisyMigrationScript } from "@/migrations/types";
const migrationScript: CaisyMigrationScript = async (sdk, projectId) => {
await sdk.PutManyBlueprints({
input: { projectId, blueprintInputs: backupBlueprints },
});
};
export default migrationScript;Contributing
- Please read the changeset docs to get familiar with the changeset tooling
- Use PRs for updates
