Skip to content

CLI migration create succeeds, but migration fails with ServerError. #9034

@TomFaulkner

Description

@TomFaulkner

The CLI generated a migration, but the migration fails with a server error.

  • Gel Version:a 6.10+b9cb801
  • Gel CLI Version: Gel CLI 7.9.0+070b371
  • OS Version: Arch Linux

Schema: (abbreviated, I can post the full schema and previous migrations if necessary)

    type Client {
        required name -> str;
        multi queued_in := .<client_queue[is Clinic];
    }

    type Clinic {
        required name -> str;
        multi client_queue: Client { extending client_queue };
    }

    abstract link client_queue {
    enqueued_at -> datetime { default := datetime_current(); }
    priority: int16 { default := 0; }  # higher number means higher priority
    constraint exclusive on (__subject__);
    }

I used the schema provided to generate a new migration, adding the queue related fields and running gel migration create to get the following migration:

CREATE MIGRATION m1afcxm7hg2tl2fxp6lp62s2erk3vrthj4u4nuspfqv55atrgfl5mq
    ONTO m1zvqbkxgbsaqflaz6jzsudjmyyafd65f2cmng3rkw2ak6d7edjttq
{
  CREATE ABSTRACT LINK default::client_queue {
      CREATE CONSTRAINT std::exclusive ON (__subject__);
      CREATE PROPERTY enqueued_at: std::datetime {
          SET default := (std::datetime_current());
      };
      CREATE PROPERTY priority: std::int16 {
          SET default := 0;
      };
  };
  ALTER TYPE default::Clinic {
      CREATE MULTI LINK client_queue: default::Client {
          EXTENDING default::client_queue;
      };
  };
  ALTER TYPE default::Client {
      CREATE MULTI LINK queued_in := (.<client_queue[IS default::Clinic]);
  };
};

After running gel migrate I get the following output:

Automatic backup is enabled, see the full backup list with "gel instance list-backups -I emh_7492".
Read more at https://geldata.com/p/localdev
Running automatic backup of local instance emh_7492...
Created Incremental backup:
10.37 MiB /home/tom/.local/share/edgedb/data/emh_7492.backups/0199621c-4981-7f01-8dd6-6fed31ae687b
Applying m1afcxm7hg2tl2fxp6lp62s2erk3vrthj4u4nuspfqv55atrgfl5mq (00013-m1afcxm.edgeql)
... parsed
gel error: InternalServerError: relation "edgedbpub.850e416b-955a-11f0-8cf1-c7d7f69e9a3b" does not exist
  Server traceback:
      edb.errors.InternalServerError: relation "edgedbpub.850e416b-955a-11f0-8cf1-c7d7f69e9a3b" does not exist
gel error: error in one of the migrations

I deleted the database and created a new one with this migration and ended up with the same result.

The intent is to create a Client queue per Clinic, with the queue weighed based on priority and then time.

The CLI migration generator believes the schema to be valid, but the migration fails.

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