#!/bin/bash
# Copied/adapted from novelpad-desktop packages/core/bin/create-migration @ 62c56b87
# Deviation: no client schema in this package, so only the single (server)
# drizzle config is generated against, and there is no separate
# build:migration-files bundling step to run afterward.

if [ "$#" -ne 1 ]; then
  echo "Usage: create-migration <migration-name>"
  echo "Or: yarn create:migration <migration-name>"
  echo "Or: npm run create:migration -- <migration-name>"
  exit 9
fi

echo "Creating migration: ${1}"
yarn build
yarn drizzle-kit generate --config drizzle.config.ts --name "${1}"
