Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to new version breaks the module. #119

Closed
sktzoootech opened this issue Apr 23, 2013 · 6 comments
Closed

Upgrading to new version breaks the module. #119

sktzoootech opened this issue Apr 23, 2013 · 6 comments

Comments

@sktzoootech
Copy link

Upgrading userforms module is not a replace the module and do a dev/build process.  No problem if you haven't defined forms from the old module. In the old userforms module there are 2 fields that doesn't exists anymore in the new one but is somehow still referred to by workflow causing a field doesn't exists error. So what I did to resolve the issue is to backup EditableFormField tables (includes live and versions), delete the tables and do a dev/build with the new userforms module. Restored the tables on a temporary tables and did a selective insert intos.

The above process works and was ok but is there a better way of dealing with this issue?

@wilr
Copy link
Member

wilr commented Apr 24, 2013

Which two fields caused you issues? We should clean up those form fields in EditableFormField::requireDefaultRecords() so that it's run on dev/build

@sktzoootech
Copy link
Author

It's "CanDelete" and "ShowOnLoad" fields. So does this mean revision on the userforms module adding a clean up process in EditableFormField::requireDefaultRecords()?

@sktzoootech
Copy link
Author

I still couldn't visualise the clean up process using requireDefaultRecords. Can you elaborate your proposal? I mean I would really love to do a pull request. :)

@wilr
Copy link
Member

wilr commented Apr 25, 2013

Ah didn't see that contrydropdown had been removed (was done by another dev). It's just been added back in so you shouldn't need any DB migrations for upgrade from the latest 2.4 version to 3.0 / 3.1 version.

For DB clean up processes you can either do it in 2 places, requireDefaultRecords() (which is run on DB build) or a custom BuildTask (which has to be run manually at dev/tasks/DoMyTask). As requireDefaultRecords() is run on dev/build it's normally easier for the user. You can do any PHP method you want in there e.g

function requireDefaultRecords() {
parent::requireDefaultRecords();

// run any DB queries or use the ORM to 'clean up' however you want
DB::query("DELETE FROM Page")->execute();
}

But saying that, we shouldn't need a migration?

@sktzoootech
Copy link
Author

Thanks Wilr. Yup we don't need to do a migration if that is the case but I appreciate elaborating on the clean up. Cheers.

kmayo-ss added a commit to silverstripe-terraformers/silverstripe-userforms that referenced this issue May 25, 2013
@kmayo-ss
Copy link
Contributor

opened the following pull request

#129

This adds a task to remove surplus columns from EditableFormField for MySQL databases

@wilr wilr closed this as completed May 25, 2013
wilr added a commit that referenced this issue Jun 4, 2013
BUG: Fixes #119 adds a tasks to clean up columns for EditableFormField
kmayo-ss added a commit to silverstripe-terraformers/silverstripe-userforms that referenced this issue Aug 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants