menu

EdgeDB

Bringing state-of-the-art database technology to the masses.

Channels
Team

A table disappears after being created

February 20, 2020 at 4:06pm

A table disappears after being created

February 20, 2020 at 4:06pm (Edited 2 months ago)
Hi!
I created this repo to make it easy to reproduce the problem: https://github.com/Mulugruntz/edgedb-playground/tree/b241ebd66e5b873ba3c446c96d9d057b08130698
Everything is explained there in the README.
But basically, a table creation that was committed seems to have disappeared after another table creation.
I tried to follow all the examples and documentation on the website. And I'm not sure whether it's a bug on EdgeDB side (I doubt it) or a documentation issue that could be improved (maybe) or something else.
I can also reply to messages on irc (I'm on #python and #python-fr, I'll reply if you send a message to my nic: Mulugruntz).
Thanks for your great work!

February 20, 2020 at 4:59pm
Migrations replace your entire schema, your replace type A with type B in your implementation. Schema describes entire database.
If you want to create types (tables), you either need to add them to the end of schema or use DDL commands: https://edgedb.com/docs/edgeql/ddl/objects#create-type
Edited
like-fill
1
  • reply
  • like
I know because I've made this mistake: you cannot use the same name for two different migrations, but it should give you an error if that was the case
  • reply
  • like
What said is correct. SDL migrations describe the state of the entire schema, so having two migrations with one type each results in first creating that type and then possibly renaming it or dropping and replacing it with the new type.
Rename vs. replace logic is currently based on heuristics of how similar the types are, but this is something that will be more user-driven in the very close future.
  • reply
  • like
I know because I've made this mistake: you cannot use the same name for two different migrations, but it should give you an error if that was the case
Actually reusing migration names should be fine as long as they are in separate transactions, but yes it will give you an error if they are in the same transaction. Having said that, we're currently re-working the migration workflow and the way names are used will change a bit, making migration names more like human-oriented description than an identifier.
  • reply
  • like
Thanks ! gave the same explanation on github :-). Well, I'm gonna be able to continue on my project, thanks to you two!
  • reply
  • like