GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Go to GitLab Docs homepage
  • What's new?
  • Get free trial
  • Use GitLab
  • GitLab Duo
  • GitLab Orbit
  • Extend
  • Install
  • Administer
  • Subscribe
  • Contribute
  • Solutions
  • Getting started
  • Tutorials

This view

  • Original page
  • New address

GeezerVison is showing docs.gitlab.com — Database migrations API | GitLab Docs

 / 

Database migrations API

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

Use this API to manage GitLab database migrations.

Prerequisites:

  • You must have administrator access to the instance.

Mark a migration as successful

Marks pending migrations as successfully executed to prevent them from being executed by the db:migrate tasks. Use this API to skip failing migrations after you determine they are safe to skip.

POST /api/v4/admin/migrations/:version/mark
AttributeTypeRequiredDescription
versionintegeryesVersion timestamp of the migration to be skipped
databasestringnoThe database name for which the migration is skipped. Defaults to main.
shell
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/admin/migrations/:version/mark"

List pending migrations

Returns a list of all pending (not yet executed) migrations for a specified database.

GET /api/v4/admin/migrations/pending
AttributeTypeRequiredDescription
databasestringnoThe database name to query. Defaults to main.

Example request:

shell
curl --request GET \
   --header "PRIVATE-TOKEN: <your_access_token>" \
   --url "https://gitlab.example.com/api/v4/admin/migrations/pending?database=main"

Example response:

json
{
  "pending_migrations": [
    {
      "version": 20240101120000,
      "name": "create_users_table",
      "filename": "20240101120000_create_users_table.rb",
      "status": "pending"
    },
    {
      "version": 20240102150000,
      "name": "add_email_to_users",
      "filename": "20240102150000_add_email_to_users.rb",
      "status": "pending"
    }
  ],
  "database": "main",
  "total_pending": 2
}
Was this page helpful?
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.