maybe_add_column

The timeline below displays how wordpress function maybe_add_column has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.3

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.2

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.4

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.4

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.4

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.5

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.3

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.3

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
    $wpdb->query($create_ddl);
    // We cannot directly tell whether this succeeded!
    // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Cannot be prepared. Fetches columns for table names.
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.2

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.1

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.9

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.8

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.7

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.9

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.9

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.8

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.7

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.5

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.3

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.9

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.9

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.8

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.7

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.6

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.6

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.5

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.7

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.9

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.8

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.7

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.6

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.6

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.9

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.9

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.7

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.6

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.6

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.5

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.4

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.2

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.1

/**
 * Adds column to a database table, if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.5

/**
 * Adds column to database table, if it doesn't already exist.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  Database table name.
 * @param string $column_name Table column name.
 * @param string $create_ddl  SQL statement to add column.
 * @return bool True on success or if the column already exists. False on failure.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column === $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.5

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.5

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.0

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.9

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 5.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.8

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.6

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.4

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.1

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @global wpdb  $wpdb
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return bool True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.7

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.5

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.3

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.2

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Adds column to a database table if it doesn't already exist.
 *
 * @since 1.3.0
 *
 * @param string $table_name  The table name to modify.
 * @param string $column_name The column name to add to the table.
 * @param string $create_ddl  The SQL statement used to add the column.
 * @return True if already exists or on successful completion, false on error.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 2.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .40

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .40

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .39

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .39

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 1.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.6

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.6

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.5

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.5

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.4

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 0.1

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.0

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 4.0

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    // Didn't find it, so try to create it.
    $wpdb->query($create_ddl);
    // We cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.8

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.8

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.6

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.4

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 9.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 *
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.9

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.9

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.9

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.6

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .39

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .39

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.3

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 8.1

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.8

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.8

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.9

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.8

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.7

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.6

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.5

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .41

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .40

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .40

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.4

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .39

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .38

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .37

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .36

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .35

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .34

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .33

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .32

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .31

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .30

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.3

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .29

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .28

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .27

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .26

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .25

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .24

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .23

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .22

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .21

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .20

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.2

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .19

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .18

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .17

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .16

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .15

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .14

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .13

/**
 * Add column to database table, if column doesn't already exist in table.
 *
 * @since 1.0.0
 * @package WordPress
 * @subpackage Plugin
 * @uses $wpdb
 *
 * @param string $table_name Database table name
 * @param string $column_name Table column name
 * @param string $create_ddl SQL to add column to table.
 * @return bool False on failure. True, if already exists or was successful.
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .12

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .11

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: .10

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 7.1

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 ** maybe_add_column()
 ** Add column to db table if it doesn't exist.
 ** Returns:  true if already exists or on successful completion
 **           false on error
 */
function maybe_add_column($table_name, $column_name, $create_ddl)
{
    global $wpdb;
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    //didn't find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    foreach ($wpdb->get_col("DESC {$table_name}", 0) as $column) {
        if ($column == $column_name) {
            return true;
        }
    }
    return false;
}