这是indexloc提供的服务,不要输入任何密码
Skip to content

down migration is executed out of order  #3621

@shahidhk

Description

@shahidhk

When executing a down migration using

hasura migrate apply --version 1578025638744 --type down

down.sql is executed before down.yaml

This issue is not there if

hasura migrate apply --down 1

is used.

Error from GraphQL Engine:

{
  "type": "http-log",
  "timestamp": "2020-01-03T05:09:34.893+0000",
  "level": "error",
  "detail": {
    "operation": {
      "user_vars": {
        "x-hasura-role": "admin"
      },
      "error": {
        "path": "$.args[2].args",
        "error": "table \"table_name_1_rel_name\" does not exist",
        "code": "not-exists"
      },
      "request_id": "b854c55c-1670-4142-a437-3e5d99934c93",
      "response_size": 100,
      "query": {
        "args": [
          {
            "args": {
              "cascade": false,
              "check_metadata_consistency": null,
              "sql": "DROP TABLE \"public\".\"table_name_1_rel_name\";\nDROP TABLE \"public\".\"table_name_1\";\n",
              "read_only": false
            },
            "version": 1,
            "type": "run_sql"
          },
          {
            "args": {
              "cascade": false,
              "check_metadata_consistency": null,
              "sql": "DELETE FROM hdb_catalog.schema_migrations WHERE version = 1578025638744",
              "read_only": false
            },
            "version": 1,
            "type": "run_sql"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "drop_delete_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "drop_update_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "drop_select_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "drop_insert_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1"
            },
            "version": 1,
            "type": "drop_delete_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1"
            },
            "version": 1,
            "type": "drop_update_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1"
            },
            "version": 1,
            "type": "drop_select_permission"
          },
          {
            "args": {
              "role": "metrics",
              "table": "table_name_1"
            },
            "version": 1,
            "type": "drop_insert_permission"
          },
          {
            "args": {
              "relationship": "api_limit",
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "drop_relationship"
          },
          {
            "args": {
              "relationship": "rel_name",
              "table": "table_name_1"
            },
            "version": 1,
            "type": "drop_relationship"
          },
          {
            "args": {
              "table": "table_name_1_rel_name"
            },
            "version": 1,
            "type": "untrack_table"
          },
          {
            "args": {
              "table": "table_name_1"
            },
            "version": 1,
            "type": "untrack_table"
          },
          {
            "args": {
              "cascade": false,
              "check_metadata_consistency": null,
              "sql": "DELETE FROM hdb_catalog.schema_migrations WHERE version = 1578025638744",
             "read_only": false
            },
            "version": 1,
            "type": "run_sql"
          }
        ],
        "version": 1,
        "type": "bulk"
      }
    },
    "http_info": {
      "status": 400,
      "http_version": "HTTP/1.1",
      "url": "/v1/query",
      "ip": "172.20.0.1",
      "method": "POST",
      "content_encoding": null
    }
  }
}

Metadata

Metadata

Assignees

Labels

c/cliRelated to CLIe/quickfixcan be wrapped up in few hoursk/bugSomething isn't workingp/highcandidate for being included in the upcoming sprint

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions