OpenParable
Skip to content
← Back to skills

Create Migration

DevOps & Security
create-migration

Create Migration is an Agent Skill for devops & security published in the OpenCTI-Platform/opencti repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Use when: creating a new ElasticSearch database migration file, adding or transforming data at deploy time

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/OpenCTI-Platform/opencti/blob/HEAD/.github/skills/create-migration/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/create-migration, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Create Database Migration

Prerequisites

  • Description: Short snake_case description of the change (e.g., add_description_to_user).

Procedure

Step 1 — Generate Migration File

Use the current timestamp (ms) as prefix. File: opencti-platform/opencti-graphql/src/migrations/<timestamp>-<description>.ts.

Step 2 — Implement Migration Pattern

Use the standard template with logging and execution context.

import { logMigration } from '../config/conf';

const message = '[MIGRATION] <Description>';

export const up = async (next: (error?: Error) => void) => {
  const startTime = Date.now();
  logMigration.info(`${message} > started`);

  // Implementation here
  // usage: const context = executionContext('migration');
  //        await someDomainFunction(context, SYSTEM_USER, args);

  logMigration.info(`${message} > done in ${Date.now() - startTime} ms`);
  next();
   };

export const down = async (next: (error?: Error) => void) => {
  next();
};