Skip to content

Cast expression suggestion when changing type of a link property references it as a standard property #1188

@raddevon

Description

@raddevon

When altering the type of a link property as shown in the schema at the bottom:

did you alter the type of property 'date' of link 'habit_completed'? [y,n,l,c,b,s,q,?]
> y
Please specify a conversion expression to alter the type of property 'date':
cast_expr> <cal::local_date>.date

Suggestion is to cast a property .date which does not exist on the type. The suggestion should be <cal::local_date>@date instead.

  • EdgeDB Version: 5.0-dev.8091+e24f7fd
  • EdgeDB CLI Version: 4.0.2+500be79
  • OS Version: macOS 14.0

Steps to Reproduce

  1. Create a schema with a link property
  2. Migrate
  3. Change the type of the link property
  4. Migrate again

Schema

Start:

module default {
    type Habit {
      required name: str;
    }
    type User {
      name: str;
      multi habit_completed: Habit {
        date: datetime;
        # Ensures a User can complete a given Habit
        # only once per day.
        constraint exclusive on ((@target, @date));
      }
    }
}

End:

module default {
    type Habit {
      required name: str;
    }
    type User {
      name: str;
      multi habit_completed: Habit {
        date: cal::local_date;
        # Ensures a User can complete a given Habit
        # only once per day.
        constraint exclusive on ((@target, @date));
      }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions