@altipla/directus-drizzle
v0.2.10
Published
Generate a Drizzle seed function from a Directus instance.
Downloads
39
Readme
directus-drizzle
Generate Drizzle schema & seed function from a Directus instance.
Install
npm i -D @altipla/directus-drizzle
Usage
Add a new download command in your
package.json
file to pull changes:{ "scripts": { "db:pull": "directus-drizzle" } }
Write a secret static token obtained from your user in Directus in your local
.env
variables:DIRECTUS_TOKEN=XYZ_TOKEN
Configure the rest of settings like the remote URL in the config file. By default it's located in
drizzle/directus.config.ts
:import { defineConfig } from '@altipla/directus-drizzle' export default defineConfig({ instance: 'https://www.foo.com', seed: { collections: ['prefix_*'], }, })
Finally run the command every time you want to regenerate the schema file:
npm run db:pull