Skip to content

Value for field "resolve" in collection "directus_operations" has to be unique. #70

Description

@IanvanderGeest

Describe the Bug

Hi there,

I've adjusted a flow in Directus, exported and commited this to my repo. My staging server is importing the changes and errors out on a database constraint.

My local and staging DB are 1:1 copies, with the only difference being the changes to this certain flow

$ npx directus schema-sync import
[14:17:38.156] INFO: Extensions loaded
[14:17:38.157] INFO: Loaded extensions: directus-extension-schema-sync
[14:17:38.163] INFO: Importing everything from: /directus/schema-sync/data
[14:17:38.196] INFO: Stitched 69 partial schema files
[14:17:41.646] ERROR: Failed loading "directus_operations".
[14:17:41.647] ERROR: Failed loading "directus_flows".
[14:17:41.647] ERROR: Failed loading "directus_presets".
[14:17:41.648] ERROR: Failed loading "directus_panels".
[14:17:41.648] ERROR: Failed loading "directus_dashboards".
[14:17:41.648] ERROR: Failed loading "directus_settings".
[14:17:41.649] ERROR: Failed loading "directus_access".
[14:17:41.649] ERROR: Failed loading "directus_permissions".
[14:17:41.650] ERROR: Failed loading "directus_policies".
[14:17:41.650] ERROR: Failed loading "directus_roles".
[14:17:41.651] ERROR: Failed loading "directus_folders".
[14:17:41.651] ERROR: Failed loading "schema".
[14:17:41.652] ERROR: Value for field "resolve" in collection "directus_operations" has to be unique.
    err: {
      "type": "",
      "message": "Value for field \"resolve\" in collection \"directus_operations\" has to be unique.",
      "stack":
          DirectusError: Value for field "resolve" in collection "directus_operations" has to be unique.
              at uniqueViolation (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2____jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/database/errors/dialects/mysql.js:62:12)
              at extractError (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2____jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/database/errors/dialects/mysql.js:15:20)
              at translateDatabaseError (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2____jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/database/errors/translate.js:22:28)
              at file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2____jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/services/items.js:189:39
              at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      "name": "DirectusError",
      "extensions": {
        "collection": "directus_operations",
        "field": "resolve",
        "primaryKey": false
      },
      "code": "RECORD_NOT_UNIQUE",
      "status": 400
    }

On a database level I understand that the script is trying to insert a duplicate value into the DB, but shouldn't the import script handle that?

Am I doing something wrong perhaps?

The directus_config.js file includes the following:

directus_flows: {
	watch: ['flows'],
	excludeFields: ['operations', 'user_created'],
},
directus_operations: {
	watch: ['operations'],
	excludeFields: ['user_created'],
	linkedFields: ['resolve', 'reject'],
}

To Reproduce

  • Create changes to an existing Flow, change the order of operations within a Flow
  • Export and commit files to git
  • Pull and import the changes on staging server

Version

3.0.9

Installed Extension Via

Docker file

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions