Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Database changes, update component

Can not update "unique" field property 19 Feb 2016 09:06 #13828

  • lastradacook
  • lastradacook's Avatar
  • Offline
  • New Member
  • Posts: 13
  • Thank you received: 1
  • Karma: 1
Hello,

I'm new in j-cook... and in my component's table I have made a mistake choosing "unique" checkbox for the field "published", instead of "required"...

So I have exported the component and tested on my localhost server... when I have added 2 items in this table... logically I can set "publish" status for the second item (because "unique") : sql error : Save failed with the following error: Duplicate entry '1' for key 'published'

So I have returned to j-cook to repair my mistake, unchecking "unique" field property. After I have uploaded the new version, the error persists.

Looking on mysql table definition, the "unique" field property is not changed.

I have resolved my problem "manually" with this sql "`ALTER TABLE #__jcmytablename DROP INDEX published;`

I hope this helps somebody
The administrator has disabled public write access.

Can not update "unique" field property 19 Feb 2016 15:28 #13829

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
Unchecking unique is a database change, which or not installed on an update.

You can do that by following the Joomla standard: docs.joomla.org/J2.5:Managing_Component_...s_(Update_SQL_files)

Don't forget to edit the version number of your component :)
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Can not update "unique" field property 19 Feb 2016 15:58 #13830

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
In facts, when you update a cook component, you have to make the database changes manually.

I know it is a little bit boring, but cook is missing this feature.
It could be a feature that take snapshots of the database structure in order to create the versions updates.
Lot of work, but half is already done because your dataset snapshots contains the database table, so cook could reuse that and step with versions.
Another possible cool feature.

I know you have solved your problem, but for others users, in case you have multiple installations, it is recommended to make a SQL version file.
Your cook component can manage such updates, look at the Joomla documentation to understand how it works.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: krasy

Can not update "unique" field property 23 Feb 2016 09:38 #13836

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
great feature for live sites,
some points would be deleted from upgrade procedure list.
The administrator has disabled public write access.
Time to create page: 0.130 seconds

Get Started