I’m frustrated

Refresh database breaks application

After I add a new table to my database (MS SQL on Azure) I run "Refresh" option to bring that new table into COT. Unfortunately this breaks all my Designer changes and rearranges my page layouts. See Screenshot 1 for the before look at the Designer and Screenshot 2 for the look at the Designer after the "Refresh". It is even worse if I look at the details of pages. Containers and Views are missing, etc.

I have found some articles such as this one: http://codeontime.com/learn/under-the...
and this one: http://codeontime.com/learn/developme...
but they seem outdated because I do not get to chose which controllers I want to refresh, COT refreshes all of them.

I can't be the only one with this issue because we have this same problem with two application that we are building. Has anyone else experienced this and found a fix?

We want to be able to run the Refresh function to make new tables/columns available in COT application without having to rebuild all the pages every time we do that.
2 people have
this question
+1
Reply
  • Tom, have you renamed multiple tables and views? Any renaming or deleting and adding new tables, views, or columns will no longer match designer transactions. For instance, a transaction may say to place "Customer" page after "Employee". If Employee is removed from the app, then that transaction will no longer replay when refreshing. This behavior preserves any "valid" changes made to the app while ignoring invalid changes, allowing you to integrate changes in the database into the application.

    As a way to bypass this, you can create a copy of your controller XML file, naming it [Controllername].baseline.xml, and the generator will use the contents of that controller post-refresh. Please note that models cannot be used with baseline 
    • view 4 more comments
    • Hi Dennis,
      I think we may have found the problem. We have created a new application using our existing database and have built a few pages. Most of our pages have parent-child relationships. Then we re-created a database view and added one column to the view (actual steps: delete existing view, create new view with same name, same columns and order of columns, plus one additional column).

      After running "Refresh" and Generate in COT, our new application is now broken. Pages are now in different order, pages what were hidden from the menu are not hidden any longer, one page that is not related to the changed database view has been renamed back to the baseline name, fields on pages are in random order, categories are gone, etc.)

      We will test further, but I wanted to pass this on to you so you can try to recreate the issue on your end.
    • This comment was removed on 2016-11-15.
      see the change log
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • I had this problem with a couple of apps, many people do, and it's hard to know exactly where you went wrong. Despite the suggestions from COT and the links you referenced, I was never able to fully identify or fix the problem. It was such a headache I cut my losses and created a new app and redid all of my changes. Somehow it worked better with the new app and I'm careful now not to break it again. Sorry that's not really an answer, but I know where you are coming from. :(
    • Allen,
      What exactly do you do when you say you are "careful not to break it"? Do you follow particular process or steps that work better?

      Seems like this is an issue with how COT handles changes to the database, not something that we are doing wrong. I have narrowed it down to the fact that this happens when we remove and re-create a view, which we are doing a lot in this stage of development in our application. What is really frustrating is that these views are not even used on the front end, they are only used for back-end processes, yet the front end breaks when we make these changes.
    • I double check every time I refresh to make sure it's still intact. I agree there should be a better way for COT to handle this and allow the developer more control over what's happening in the refresh and generation processes.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • I am not 100% sure this will address your problem, but I can say I have found similar frustrations with the process of making changes to the database schema which then 'breaks' the COT generated code.

    The process I use after each database change:

    Adding Schema changes to DB with COT
    -----------------------------------------------------
    1. Drop the entity in the Model

    2. Refresh in CoT

    3. Add the entity back into the Model

    4. Generate

    5. Browse (if needed after Generate)

    This seems to work for me
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Hi

    Not sure why this is happening but just to let you know that yesterday afternoon I created a small app with 10 tables/35 pages which I created one by one in SQL and COT, refreshing/modelling upon creation of each Table/Controller/Page etc. and not once a problem has occurred and the app is already online and being used by my client.

    I must actually admit that this version is working very well and has not created me any problems at all!

    Mike
    • Hi Mike,
      Thanks for the feedback. We have built couple of fairly complex apps in COT and haven't had this problem until recently. We are backtracking now in an attempt to identify exact point at which both applications started experiencing this issue. It would be too complicated at this time to rebuild everything from scratch, and creating controllers and baseline pages/models manually defeats the purpose of using COT.
    • Hi Mike,
      We may have narrowed the problem down to changes we have made to database views. If you have a few minutes, could you create a view in your database, build a page based on that view in COT (make sure to change it from the baseline design to something more complex/different), then add a column to the database view and run "Refresh". Let me know if your application still looks the same as it did before changing the database view.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Hi Dennis,
    Do you have any updates on this issue? We just ran into this problem again, WITHOUT making any changes to the database. This time we simply added an existing column to the application by checking the box it in Model. After Generating the application the changes that were made recently are gone. Some of the changes that have disappeared are not related to the table whose field was added to the model. See attached screenshot - these are just the missing changes that I have noticed immediately, I'm afraid to look further through the application.

    Are we missing a step in our process of making changes in Model/Refresh? Should we run Generate before we run Model/Refresh? Any other steps that need to be performed to insure that changes are not lost?

    Thanks
    Tom
    (Comment moved to Reply in order to add attachment)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Same problem for me... It breaks my project every time models are modified.
    My only workaround is backup Application.Baseline and Log Files, then overwrite the generated Application.* Files after refresh. I checked the Baseline and Log Files and a lot of pages where omitted.
    Maybe this has something to do with Log and Baseline file not being friendly with each other? or does this have something todo with sync file?
    • Hi Mark,
      We have developed another theory of why this may be happening but have not tested it. We have found some issues with our database such as missing or broken metadata/schema (I am not a db admin so please pardon my ignorance here). It is possible that as COT Model process reads the database information it encounters issues which cause it to create a baseline that is inconsistent with the log files (we have noticed some errors in COT log as Model runs the refresh function). Then when log files are applied they mess up the front end application.

      Again, we have not tested this theory because we were too busy continuing the development and have stopped using the Model feature in COT. Hopefully you are more familiar with SQL and have time to test this theory.

      Sincerely,
      Tom
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • This is happening for me as well. I'm pretty sure it has to do with the Application.log.xml and/or Controllers.log. xml file not being read/processed during the refresh, as per this topic: http://community.codeontime.com/codeo...

    I get a similar error while refreshing and it says something like "'Script' start tag on line 1550, position 4 does not match end tag of 'Log'. on line 1556" Then all my design changes move back to baseline. There is no Script start tag anywhere near line 1550 of any of the log files, so it makes it difficult to know what's going on.

    Bottom line, the Refresh process apparently starts by reverting back to baseline, and if it doesn't process the Application or Controllers log changes, it stays that way.

    What would be nice is a tool to correctly recreate bad log files based on a diff between the baseline and the existing design (I'm not clear how the logs get bad, since I've never touched them). But to say "resolve any errors in the log files" doesn't really help (I ran them through an XML syntax checker and all was fine), especially without good errors designating the log filename and where and what the problem is.
    • Just a follow-up on what ended up working for me to resolve the problem with help from COT.

      1. Backup project.
      2. Delete all ~/Sync.***.xml files (and make sure no Sync.*** files, even .zip files are there, as COT will try to read them).
      3. Open project in the Project Wizard.
      4. In Settings, Source Code and UI, set Source Control to "None".
      5. Run Refresh.
      6. Set Source Control back to "Git".
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited