Jump to content

Upgrade Routine


Midnight Modding

Recommended Posts

Any tips on my upgrade routine? In 3.x I did not use a built in file upload system, I uploaded them with my own code, and so I need to know the easiest way of updating those AND also I guess I need to go through updating titles to the custom lang bits, right? Any easy built in way to do that in mass without me writing something?

I'm finished as a fresh install, and I just tested my memberSync and moving files to resources/ (had them elsewhere…) and all is great, so upgrade routine, then done. (also had already thoroughly tested and got bugs ironed out everywhere.)

Link to comment
Share on other sites

Welcome to the most boring step of your app.

Maybe someone else has a more appropriate way to do this but that’s what I’ve done in upgrade for two resources I own: 

- TO MAKE THE UPGRADE ROUTINE:

  • In the version you want to upgrade, add the upgrade.php and use one step for each table or conversion you need to do in upgrade.php.
  • You will have to make a foreach select in your categories table, convert title and description to lang bits, etc.

More: https://invisioncommunity.com/developers/docs/development/applications/versions-and-upgrading-your-application-r51/

- TO TEST THE UPGRADE ROUTINE:

  • You have to uninstall the app and move the app folder from applications folder to your desktop, for example. Otherwise it will appear in apps not installed.
  • Insert, via PHPMyAdmin, the entries in core_applications and permissions_index tables from your app/categories. Rebuild cache. Then it will appear as Outdated app.

Above are general lines of how I did.

You better take a look first in Forums app, for example.

Link to comment
Share on other sites

I clicked download in the acp, clicked build new version, clicked the button, downloaded it, and now I can't do anything in the acp, due to the following exception:

Can't find file: './xxx/ibf_appname_custom_images.frm' (errno: 2 - No such file or directory)

what is going on with that? This is all confusing, as I wasn't sure whether I needed to click build app first, but then when clicking download it said build app within that form anyway... and now I have this exception.

Documentation not being created telling how to actually prepare the app for release is a big omission. I ahd to just guess what to do, assuming that clicking download and build new version would be all there is to it. No clue what custom images directory it is looking for or why it suddenly does that just because I downloaded.

In fact the whole board can't be used now while I try to figure that out.

Link to comment
Share on other sites

ok, what it's doing is it's trying to rename a table I used to have with the above name. But the name change was done through developer center so of course it ALREADY has been changed to that name. Why in the world would it change the name at the time I renamed it in developer center, yet then try to do it again now when I view any page of my site?????

you have anything like this happen, @Adriano Faria? it's like it's executing the new version's queries on the site that the new version was developed on!

I assume I could still give the customer the file I downloaded, as this would only be an issue on my test site? But what now? 😞

I see in queries.json which line tries to rename that table, but, again, why would it be trying to do these when this is a development site where it was already done?

Link to comment
Share on other sites

35 minutes ago, Adriano Faria said:

Not that I remember but upgrader is a pain, as I already told you that before. A lot of things and unexpected errors here and there. It's just like when you first put your hands on IPS4: you will learn with the errors.

well I am stumped how to get out of this one.

Why would there be a file on my server named after a database table? A table that has long since been renamed too...

And now I just noticed, even in the file it gave me, and on my test site, it did not create an install directory at all!! Doesn't it need that directory always, or is it only when the app needs to add something beyond the main schema?

My latest version in 3.x was called 1.9.0. When I clicked download, it asked did I want to rebuild 1.9.0, build a new version, or download without building. I selected build new version, as this was intended to be version 2.0.0. I then downloaded the file, closed the form, and now every page on the site has the exception thrown.

I looked a bit through the trace and saw where it said RENAME TABLE in it. I then looked in queries. json and I see where it says to rename that table... but this is all stuff that was already done on this site.

Could this be that I slipped up the dev checker for whether or not my db is up to date because I renamed a table and then added a new table with the same name the old one had? Regardless, I don't know what to do next... Maybe if I figure it out, editing queries.json is needed?

Link to comment
Share on other sites

29 minutes ago, Midnight Modding said:

And now I just noticed, even in the file it gave me, and on my test site, it did not create an install directory at all!! Doesn't it need that directory always, or is it only when the app needs to add something beyond the main schema?

Install directory? No. It will export a .tar file. That's all.

29 minutes ago, Midnight Modding said:

Could this be that I slipped up the dev checker for whether or not my db is up to date because I renamed a table and then added a new table with the same name the old one had? Regardless, I don't know what to do next... Maybe if I figure it out, editing queries.json is needed?

Honestly, this is not a common thing so probably you did something that shouldn't I guess. Take a look in /applications/your_app/data/schema.json to see what shows there regarding this table.

You better mention Brandon in your post.

Link to comment
Share on other sites

3 minutes ago, Adriano Faria said:

Install directory? No. It will export a .tar file. That's all.

yes ,but I mean inside the tar file, in setup/ there is no install/ shouldn't there be? or is it only needed for custom code?

ps you clicked in here at a good time because you happened to read after I did tons of edits to my post. lol. a few mins earlier and it would have been a much different post.

Link to comment
Share on other sites

2 minutes ago, Adriano Faria said:

No. setup is the folder which has the upgrade files. For the install process, it runs files from data folder (schema, settings, furl, etc).

ah ok, thanks. well I am guessing this will work for him as a fresh install, then. don't you think my issue is solely related to my test site? I could technically even uninstall it and then install from my tar to fix it, I bet. But I of course still want to be sure there is no issue that would affect another site.

Link to comment
Share on other sites

14 minutes ago, Adriano Faria said:

 

nothing. there is nothing whatsoever in the schema file for that table. the absolute only place it's mentioned is in queries.json  where it's saying to rename it.

All I did was any time I needed to make changes, I did it in developer center->schema.

I had imported my versions file from 3.x, but I did not do the queries for those versions yet because 1. this customer is the only one using it and doesn't need it upgrading from past versions. 2. Brandon said there's no problem adding that stuff in later.

Other than that I did nothing, so I can't think what I could have done to cause an issue. I did all of my settings, extensions, etc etc etc everything in developer center, the app was working perfectly, I clicked download -> build new version, downloaded it, poof, this issue.

btw, the reason I said install/ in setup/ is because it does have that folder in other apps. Like I said, maybe it's only for custom code, though, but it is definitely there, for instance, in gallery.... that has a setup/install/. I remember docs saying sometimes you must put the same code in your new version's upgrade file and in the install/ one, so I guess just when you need custom queries that the main schema doesn't do.

Link to comment
Share on other sites

11 minutes ago, Midnight Modding said:

btw, the reason I said install/ in setup/ is because it does have that folder in other apps. Like I said, maybe it's only for custom code, though, but it is definitely there, for instance, in gallery.... that has a setup/install/. I remember docs saying sometimes you must put the same code in your new version's upgrade file and in the install/ one, so I guess just when you need custom queries that the main schema doesn't do.

install is different than setup/install.

setup/install will run queries like add columns to core_groups or core_members, etc.

{
    "1": {
        "method": "addColumn",
        "params": [
            "core_groups",
            {
                "name": "g_create_albums",
                "type": "TINYINT",
                "length": 10,
                "null": false,
                "default": 0,
                "comment": "Can create albums?",
                "unsigned": true
            }
        ]
    },
    "2": {
        "method": "addColumn",
        "params": [
            "core_groups",
            {
                "name": "g_create_albums_private",
                "type": "TINYINT",
                "length": 10,
                "null": false,
                "default": 0,
                "comment": "Can create private albums?",
                "unsigned": true
            }
        ]
    },
      
    ...

 

Link to comment
Share on other sites

yes, but setup/install is what I was talking about. Just explaining why I originally thought it was there for the main install.

Now I have a real headache. guess what else I did? For some unknown reason I had an uploads folder within my app directory so it added it to my download. lol. With a lot of files, which basically were already there for resources also. I just deleted it from the tar and my server. I wonder where it stores the resources, though. (edit: oh I see them... in theme.xml)

I'm about to get some sleep. I'm stressed over this and only 3 days left on my fantasy baseball. 🙂

(and I told the customer he'd have the app now..... as I thought this would go smoothly downloading the tar... which for HIM it probably wll, as I assume this is just an in_dev issue.)

Link to comment
Share on other sites

The error message is a MySQL error telling you that the table you are trying to query against doesn't exist (basically).

The most likely reason for this based on what I'm seeing in this topic is:

1) You used the developer center to update your app (which is the correct approach). When you rename a table in the developer center, it renames it in MySQL automatically.
2) You then later uninstalled the app to test the upgrade routine but you still have the current/adjusted tables in your database. This is where your problem would occur. You need to remove the 4.x tables and reimport the 3.x tables into the database if you are trying to test the upgrade routine.
3) You then ran the upgrader, which is trying to rename table_a to table_b but table_a does not exist (because it was already renamed to table_b when you did so in the developer center).

In short, your best bet is to actually take a 3.x backup and try upgrading that.

Link to comment
Share on other sites

1 minute ago, bfarber said:

The error message is a MySQL error telling you that the table you are trying to query against doesn't exist (basically).

The most likely reason for this based on what I'm seeing in this topic is:

1) You used the developer center to update your app (which is the correct approach). When you rename a table in the developer center, it renames it in MySQL automatically.
2) You then later uninstalled the app to test the upgrade routine but you still have the current/adjusted tables in your database. This is where your problem would occur. You need to remove the 4.x tables and reimport the 3.x tables into the database if you are trying to test the upgrade routine.
3) You then ran the upgrader, which is trying to rename table_a to table_b but table_a does not exist (because it was already renamed to table_b when you did so in the developer center).

In short, your best bet is to actually take a 3.x backup and try upgrading that.

This is the first time I ever clicked the download button and I have never uninstalled it, reinstalled it, run the upgrader, etc...

From start to finish, all I have done related to the db is: created the app in acp, did everything through developer center such as importing tables from my database (I added them through phpmyadmin from my old test site's db), imported my 3.x versions file, did various DB changes in the main schema tab and that's it.

So for some reason, even with never having run the upgrader or uninstalled it, it's wanting to update tables just by browsing the site and it's through the dev syncing.

I assume it would not affect a fresh install or even another site upgrading, but I still hate to not figure it out, just in case it matters for some reason.

I never installed it at all, by the way. Was I supposed to do something by turning in dev off to officially install it? I assumed not.

Link to comment
Share on other sites

I haven't yet looked at what even triggers changes being made when in dev. does it automatically execute the queries from the latest queries.json if the schema isn't the same? Or is this some situation where it's doing it because the app version wasn't updated so it thinks it needs to upgrade it? Like I said, I never installed or upgrades, all I did was create the app then click download. Was I supposed to go out of in dev and install it or something?

Link to comment
Share on other sites

what I don't get is there were other "rename table" in queries.json before this one and those didn't throw the exception and those tables weren't there anymore, either.

So this makes no sense at all. first of all why it's even trying to do anything from that file and secondly even if it DOES do it, how could it only error out on one part of it?

The customer needs this asap and I don't know what to do next, other than look through the files from the trace to figure out what is happening during dev sync or delete everything and install it normally from my tar.... but then if my tar has an issue, I'd have everything messed up.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...