API page: https://api.drupal.org/api/drupal/core%21includes%21database.inc/functio...

An optional parameter should be marked thus:

 * @param string $from
*   (optional) The email address to send the mail from, if different from
*   the site-wide address.   

The docs here just have:

Optional keys and indexes specification to be created on the table along [...]

Comments

ducktape’s picture

Status: Active » Needs review
StatusFileSize
new2.38 KB

Added "optional" tag for parameter in db_add_field(), db_change_field and corresponding addField & changeField methods in Schema.php

dawehner’s picture

Usually we also describe the default avlue for these fields, see http://drupal.org/node/1354

ducktape’s picture

It does mention the default value, but only when it's not obvious from the function signature. The "array()" looks clear enough to me.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

I think this is fine. In this case, it seems pretty clear that if you do not specify keys/index then you will not be creating any keys/index, and the default of array() is in the function signature, as stated in #3. Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: schema-documentation-2273337-1.patch, failed testing.

  • Commit eea6b16 on 8.x by jhodgdon:
    Issue #2273337 by ducktape: Fix docs for add field methods for Schema...
jhodgdon’s picture

Version: 8.x-dev » 7.x-dev
Status: Needs work » Patch (to be ported)

Test failure is #2273489: Random test failure 'Created time is correct.' in GenericCacheBackendUnitTestBase/ApcuBackendUnitTest, not due to this docs-only patch. Rather than test again, I went ahead and committed to 8.x. Thanks again!

Time for a 7.x backport please!

vegantriathlete’s picture

Assigned: Unassigned » vegantriathlete

working on this

vegantriathlete’s picture

Assigned: vegantriathlete » Unassigned
Status: Patch (to be ported) » Needs review
StatusFileSize
new2.4 KB

Patch for 7.x attached.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks like the right reroll, assuming the bot agrees.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks again! Committed to 7.x. On to 6.x... beware that in 6.x there are different versions of the database functions for different database drivers (different from how it is done in 7.x/8.x).

vegantriathlete’s picture

Assigned: Unassigned » vegantriathlete

Working on backport to D6. Comments noted from above.

vegantriathlete’s picture

It looks like the functions are included in just one file: database.mysql-common.inc. However, I am not finding a schema.inc. Is this not a part of D6?

vegantriathlete’s picture

It looks like schema.inc was included in database.inc in D6 according to: https://api.drupal.org/api/drupal/includes%21database%21schema.inc/group...

vegantriathlete’s picture

StatusFileSize
new0 bytes

Patch for D6 attached.

vegantriathlete’s picture

Status: Patch (to be ported) » Needs review
vegantriathlete’s picture

Assigned: vegantriathlete » Unassigned
amitgoyal’s picture

Status: Needs review » Needs work

Patch in #15 contains nothing, 0 bytes.

vegantriathlete’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB

I'm not sure how I ended up uploading an empty patch file. Here's the correct patch.

jhodgdon’s picture

Status: Needs review » Needs work

I'm not sure either, but I've seen it happen before and have even had it happen to myself occasionally. I filed:
#2284003: Zero-byte files
to investigate it.

Regarding this patch... It looks fine, but there is also a PostgreSQL version of the db_add_field function, so it probably needs an update too?
https://api.drupal.org/api/drupal/includes!database.pgsql.inc/function/d...

The last submitted patch, 19: schema-documentation-2273337-19.patch, failed testing.

jhodgdon’s picture

No need to retest, since the patch needs work anyway... test bot glitch there!

amitgoyal’s picture

Status: Needs work » Needs review
StatusFileSize
new2.23 KB
new1.03 KB

Yes @jhodgdon, you are right that there is also a PostgreSQL version in #20.

Please review updated patch for the same.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good now, thanks!

vegantriathlete’s picture

Status: Reviewed & tested by the community » Needs work

It's actually still not right. It should be "Keys" not "keys". Let me see about doing a quick fix.

vegantriathlete’s picture

Status: Needs work » Needs review
StatusFileSize
new2.23 KB
new1011 bytes

Here ya go!

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Good catch!

  • Commit 461c821 on 6.x by jhodgdon:
    Issue #2273337 by vegantriathlete, amitgoyal, ducktape: Fix up docs for...
jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks again everyone! Committed to 6.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.