Index unique column is not being enforced outside of editor.

5 posts by 2 authors in: Forums > CMS Builder
Last Post: Tuesday at 2:45pm   (RSS)

By kitsguru - May 31 - edited: June 1

I have a plugin that adds a record to the deliveries_audit_log. I have it checked as unique and indexed. It seems to me that it should make the key unique. It doesn't.

ZenDB does not appear to support the REPLACE command, which can be used as an alternative to INSERT. Right now, we need to do a get or query, then insert for each record. 

Also would views and stored procedurs be possible?

Jeff Shields
yaadev.com

Thanks, I can implement that. While on the subject the other think that would be nice is adjusting the default value. When I added a column using quick add, ithe editor creates a medium text field by default with null as the default value. I realized I wanted this as a int with default 0. The column editor changed the data type Ok but ignored the default value leaving it at null. Not a big deal to change it via rhe developer console or any database tool, it would be great if when default value is set, that it was refected in the mysql source. 

Jeff Shields
yaadev.com

Hi Jeff, 

In the field editor "Default Value" is what appears in the field when you create a new record in the CMS.  The user can see this value and change it if needed.

For MySQL, you can set a custom column type at the bottom to something like "INT DEFAULT 555" (without quotes), and if any code attempts to insert a row without specifying a value for that column, it will be set to the specified value (e.g. 555).

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

That was slick - it worked like a charm. Wish I had realized that 10 years ago.

Jeff Shields
yaadev.com