@altipla/directus-drizzle
v0.5.1
Published
Generate a Drizzle seed function from a Directus instance.
Readme
directus-drizzle
Generate Drizzle schema & seed function from a Directus instance.
Install
npm i -D @altipla/directus-drizzleUsage
Add a new download command in your
package.jsonfile to pull changes:{ "scripts": { "db:pull": "directus-drizzle" } }Write a secret static token obtained from your user in Directus in your local
.envvariables:DIRECTUS_TOKEN=XYZ_TOKENConfigure 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
