Wix Keeping Old Data Structures & Causing Problems?

Yesterday I posted this silly newbe question about some code I had that should have worked but that was [not:](not:

https://www.wix.com/corvid/forum/community-discussion/silly-newbe-question)

[https://www.wix.com/corvid/forum/community-discussion/silly-newbe-question](not:

https://www.wix.com/corvid/forum/community-discussion/silly-newbe-question)

Some great folks weighed in and I learned some about coding in Corvid. They did not fix my issue, which (if you read the post) turned out to be related to Wix holding on to old field names after those fields’ names had been changed. After the change, Corvid was still looking for the old field names to be referenced in javascript, rather than the new names (even though the old named had never been used in javascript).

Well, long story short, I got everything working nicely, by referencing the OLD field names in the code. But that was messy and gross and I did not want it to be that way. So, I decided it would be best if I simply deleted the old collection and rebuilt it from scratch (big mistake). The old collection still has not gone away. I needed to use a new name for the new collection. And that meant I needed to redo a whole bunch of other stuff, too.

One of the things I needed to do was reconnect all of the elements in my data entry screens to a new dataset that points to the new collection. It was tedious work, but did not take much brain power. But, now none of them work. The only error that is reported in the log is that “some of the items failed validation.” But all of the items on the screen have valid data in them and when I inspect the current item, the elements in the item are all correct.

I have this nagging feeling that those old data elements are hanging around and causing problems, but I have no idea how or where to look. When I started developing in Corvid I kind of liked it. Now, I want to throw it out my window. Frustrated, but appreciate the help of kind people here.

It seems like this issue isn’t to do with the Corvid language so much as Wix’s data structure.

BTW, if you ever need to do this again for whatever reason…it is much easier to export your database as a CSV, open it up in an IDE like Visual Studio or Codium, and use the ctrl + f tool to delete all your old fields at once.

Then all you have to do is import the new data into your new database. It’s much easier than it sounds and should take like 10 minutes.

1 Like

Thanks. For now, I ended up restoring an earlier version of the website with the old data collection. The renamed fields are still a bit of an issue for me, but it is all working.

I’ve been there before.
To prevent problems, I have one collection that holds the current names of the active collections and the active date (to verify the correct collection).

For example, if you have to import a new collection monthly, you can have a collection that holds pertinent info on the names of your current databases in use (you can call it " dbInfo ," for example):


In the backend you have a jsw that holds the functions to read the active Database info

export async function getActiveRosterDb() { ... }
export async function getDbDate() { ... } 

All the code throughout the site checks to get the name of the active collection (and active date) from the dbInfo collection through the functions in the jsw.

This way, you never have to change any code when you decide to change a particular collection or all of them.
So when I import the next month’s collection for a Roster (etc.), all I have to do is change the fields in the dbInfo collection and that’s all:


This way you can tinker with new collections without touching existing code.
So if you screw up a collection, instead of suffering through the way Wix handles all of that (poorly, no database tools to speak of), just make a new collection and change your “directory” collection.

This setup is good practice in any case.

2 Likes