edgedb icon indicating copy to clipboard operation
edgedb copied to clipboard

prohibit mutation of schema::Migration

Open 1st1 opened this issue 1 year ago • 1 comments

schema::Migration should be read-only. Currently it allows DELETE (and INSERT seems to be allowed to as long as you can compute the hash, I think). We should prohibit any modifications inside the schema:: namespace with DML.

cc @ambv

1st1 avatar Aug 04 '22 20:08 1st1

Deletion of schema::Migration is used in single-db tests to nuke the database (added here), we probably want to use the future version of wipe-db for those tests instead.

fantix avatar Aug 06 '22 18:08 fantix

Hey, would you mind providing some more information on this issue (at a new contributor level of understanding).

Also, could you provide a test case that triggers this behavior?

nmakhari avatar Oct 23 '22 00:10 nmakhari

delete schema::Migration ought to produce a nice error message. Currently, it succeeds. Fortunately, it never actually deletes anything, because there is an access policy on it that causes objects to not be visible to the delete.

Additionally and closely relatedly, delete schema::Object (and update, insert) will produce an internal server error, as it compiles into broken SQL for various reasons.

We ought to do a proper error check for all of these "mutating objects in the standard library" cases and produce a proper error message.

edb/edgeql/compiler/stmt.py is the place where statements get compiled from the AST to our IR, and is where the checks should happen

msullivan avatar Oct 25 '22 01:10 msullivan