Skip to content

[Core, Arango] Database Migration: Add Repository Type Field to Database Schema #1516

Closed

Description

@AronPerez

Description

As a database administrator, I want to add a 'type' field to all existing repository documents and ensure new repositories have this field so that the system can distinguish between Globus and metadata-only repositories.

Migration Script Example

// Migration: add_repo_type_field.js
db._query(`
  FOR repo IN repo
  FILTER \!HAS(repo, 'type')
  UPDATE repo WITH { type: 'globus' } IN repo
  RETURN NEW
`);

// Validation
const reposWithoutType = db._query(`
  FOR repo IN repo
  FILTER \!HAS(repo, 'type')
  RETURN repo
`).toArray();

if (reposWithoutType.length > 0) {
  throw new Error(`Migration failed: ${reposWithoutType.length} repos still missing type field`);
}

Rollback Script

// Rollback: remove_repo_type_field.js
db._query(`
  FOR repo IN repo
  UPDATE repo WITH { type: null } IN repo
  OPTIONS { keepNull: false }
  RETURN NEW
`);

Acceptance Criteria

  • Create migration script to add 'type' field to existing repository documents
  • Set default value of 'globus' for all existing repositories
  • Ensure migration is idempotent (can be run multiple times safely)
  • Create rollback script to remove type field if needed
  • Validate that all repositories have a type field after migration
  • Update any database indexes that might be affected
  • Test migration on a copy of production data
  • Document migration procedure and rollback steps

Resources

  • Engineering Design Document: spec.md - Data Model Impact section
  • Repository collection: ArangoDB 'repo' collection
  • Migration approach from spec:
    {
      "filter": { "type": { "": false } },
      "update": { "": { "type": "globus" } }
    }

Dependencies

Activity

  1. changed the title [-]Database Migration: Add Repository Type Field to Database Schema[/-] [+][Core, Arango] Database Migration: Add Repository Type Field to Database Schema[/+] on Jul 8, 2025
  2. added theissue type on Jul 8, 2025
  3. self-assigned this
    on Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions