edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

DDL snip-it output from create-migration seems confusing

Open fmoor opened this issue 4 years ago • 1 comments

The DDL snip-its that are sometimes printed when a migration is created seems confusing. It feels like just that snip-it is supposed to mean something to me. Which is strange behavior if the average user is not supposed to have much knowledge of DDL.

$ edgedb -I workout create-migration
did you create object type 'default::Exercise'? [y,n,l,c,b,s,q,?]
y
did you create scalar type 'default::SetIndex'? [y,n,l,c,b,s,q,?]
y
did you create object type 'default::Set_'? [y,n,l,c,b,s,q,?]
y
did you create object type 'default::Workout'? [y,n,l,c,b,s,q,?]
y
Following extra DDL statements will be applied:
    ALTER TYPE default::Set_ {
        CREATE LINK workout := (.<sets[IS default::Workout]);
    };
(approved as part as part of an earlier prompt)
Created ./dbschema/migrations/00001.edgeql, id: m1z3hazlyryk3uw2ewzzf27tv642vkudtgk3ma466dnckjrcnric3q

schema.esdl

module default {
	type Workout {
		required property started_at -> datetime {
			constraint exclusive;
			default := datetime_current();
		}
		multi link sets -> Set_ {
			constraint exclusive
		};
	}

	type Exercise {
		required property name -> str {
			constraint exclusive;
			constraint min_len_value(1);
		};
	}

	scalar type SetIndex extending sequence;

	type Set_ {
		link workout := .<sets[IS Workout];
		required link exercise -> Exercise;
		required property index -> SetIndex {
			constraint exclusive;
			constraint min_value(0);
		};
		required property weight -> float32;
		required property reps -> int16 {
			constraint min_value(0);
		};
	}
};
  • EdgeDB Version: package:1.0b2.dev5478+g25318fe0e-2021022200~focal.nightly
  • EdgeDB CLI Version: edgedb-cli 1.0.0-beta.1
  • OS Version: Linux 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

fmoor avatar Mar 02 '21 21:03 fmoor

The idea is that this is a part of did you create object type 'default::Set_'? [y,n,l,c,b,s,q,?] question. And this is indicated by (approved as part as part of an earlier prompt). So it might be confusing not showing it, if you have listed DDLs before, and then this piece of DDL just appears in the final migration file out of nowhere.

Note also, that we don't hide DDL at all. You can use l[ist] and c[onfirmed] commands in the interactive mode to list DDL and also we show a piece of DDL when you run edgedb show-status. So I don't see anything confusing or problematic here.

tailhook avatar Mar 03 '21 14:03 tailhook