Transferring Entities Between Development Stages

I’m fiddling with entities in a REPL, and because of the way things are set up, it’s very easy to accidentally destroy things. I’m turning off isComponent where I find it, but I still seem to wake up and find pieces missing. Since all my fiddling is done under a single parent entity, “bas”, I’ve figured out I can just pull “bas” whenever I reach a stable point, and then tx on “bas” if I screw something up.

Anyway, when I’m done fiddling, I want to be able to take the child entities and move them bodily to stage and prod, so that I don’t have to repeat the potentially disastrous fiddling anywhere that counts.

This should be fine because the content started from the same source and periodically prod gets copied down to stage and dev, and asserting already true things about an existing entity is not a problem for Datomic—except that I’m adding new entities as well, and the IDs assigned in dev may be used for live data in prod.

In other words, I have template 123 which means “foo” and that’s fine because “foo” is 123 everywhere. But in my fiddling I’m going to add “bar”, and it gets 125 in dev. But, uh oh, a user registered in prod, and HE got the 125 ID, so Bad Things could happen if I try to assert that 125 is a “bar”.

Since “foo” and “bar” can be pulled by their parent “bas”, I was trying to do that, but maybe I need to pull “foo” by itself and “bar” by itself, and then remove the IDs from bar.

I think no matter what, I’ll have to remove the IDs from bar. Or is there an easier way to go about this?

Anyone have any thoughts? This has proven to be quite challenging.

Trying to import the structure I need and getting an error:

:db.error/invalid-entity-id Invalid entity id: 17592186727046

My initial thought was that it didn’t like the structure, somehow, but it is a number. It is a valid number. It’s a number that isn’t in use in the system currently. It’s not a reference.

The only thing I’m seeing on the Internet says you can’t do this: You can’t give the ID for a new entity. That’s weird because I’ve been doing this for the past couple of weeks.

In fact, I just did it again (in the problem area) but with a tree that doesn’t include that offending ID, unless the issue is really that, even if you retract an entity and all its underlying entities, it’s still there on some ghostly DB level, so you can essentially re-insert a previously retracted entity.

Because I think what happened here is that I pulled the tree with my minor tweaks to existing entities first, and that was fine. Then I created the new entity, then I pulled that tree, and that was fine in the environment I created it in, but that tree won’t work in a new environment. :expressionless: