1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quick question about new columns added to an existing xf column

Discussion in 'XenForo Development Discussions' started by DJ XtAzY, Mar 5, 2014.

  1. DJ XtAzY

    DJ XtAzY Active Member

    So I've been creating some in-house addons and it's been doing great...until I disable them. I did add new columns (varchar types) to an existing xenforo table. Basically my question is that if I do create new columns and add them to an existing xf table, should I set them to default to NULL? I did extend DataWriter so I guess when I disable the addon, the original DataWriter class doesn't know what values to set for those extra columns. I just learned this now from Mike's quote:

  2. Brogan

    Brogan XenForo Moderator Staff Member

    What are the columns for and how does the code utilise the content?
    Depending on the use you may need to set them to NULL, 0, or something else.
    Chris D likes this.
  3. Chris D

    Chris D XenForo Developer Staff Member

    Yeah, as Paul says, every column you add to a default table should have a default value. What that is, is sort of irrelevant. It could be anything.

    The exception is BLOB and TEXT and several other field types and their variants. These cannot accept a default value. So for those field types you should allow NULL.

Share This Page