Consequences of renaming a column?

Options
Hello! I discovered one of my front end tools doesn't do well with capitalized fields. I have been using camelCase for my column names in Xano, and I realized the easiest fix would be to switch them to all lower case. However, Xano has an ominous warning saying "Renaming your column name will not preserve existing data." What does this mean? If I rename the column, will all the existing data in that column disappear? Or if I rename the column, will none of the APIs using the column continue to work? What are the actual consequences of renaming a column?

Additionally, the warning mentions "A manual migration may be required to prevent data loss." What does this manual migration entail?

Kindly,
Marianna

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Yes, renaming your column will result in data loss at this time. That's something we do want to improve upon. 

    Additionally, yes renaming your column will mean in your APIs anything referencing the old column name will need to be updated. 
  • Sean Montgomery
    Sean Montgomery Administrator

    ADMIN

    Options
     a workaround would be to create a new column, then create a function that queries all records and copies the value into the other column, and then remove the previous column. You still will need to update your APIs. Changing column names definitely is not something that should be done lightly as it has a snowball effect with required changes.

    We 100% can do better by copying the data for you which we plan on doing, but I don't see an easy way to update the API - that still seems like it would be manual.
  • Marianna Kerppola
    Options
     and  - Thanks for clarifying! Glad I didn't go ahead and change the name! I can figure out a work around. Thanks!
  • Eric Greene
    Options

    Hi I am new to the community and new to building apps.

    I was wondering if there has been any updates regarding this matter.

    Since I am still playing around with the database and trying to find the best structure and configuration, I am not able to foresee the consequences I may or may not have with the initial naming of columns.

    This slows down the trial and error process and I would like to focus on how I would like to use my DB and the logic behind it, and I don't want the name of the column to be an obstacle, especially when I am trying to handle 150+ columns and tens of thousands of rows.

    I am still very new to databases but I am also currently using Airtable. If I do not want to be troubled by the column names do you think it would be a good option to use Airtable? I would like to make use of the Object type column for complicated data so I would love to be able to change column names.

    Thank you for any support!

  • Max
    Max Member
    Options

    usually only developers will ever see real column names, on frontend or in app you present your data whatever you want.
    If its crucial to rename column, or more likely to change column type and keep data - make a new column of desired name, type and settings and then use a function to copy data from old_column to new_column.

    i was also seriously bothered by this when started using Xano, but realization of fact 1, and as consequence - realization that i will need such thing rarely or never, gave me peace of mind.

  • Eric Greene
    Options

    Hi Max!

    Thank you for your kind response. Now I have been diving for a few days, and I'm starting to understand what you mean! It's less bothering as I get to know more about Xano. I'll try not to be anxious about the small things and keep an eye on the big picture!

    Thanks again!

  • Louis Machado - CSA
    Louis Machado - CSA Administrator

    ADMIN

    Options

    For the ones looking for a workaround for that, you can find below a basic, step-by-step tutorial on how to create a new column under your desired name and transfer the data from the old column to this new one. This way, you can effectively retain the column under its new name.

    https://www.loom.com/share/aaef9a497e464742adf3bce03a0cf456?sid=8929e877-0046-4398-954d-c8c83f70d23f