SET @users_name_exists = (
    SELECT COUNT(*)
    FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = DATABASE()
      AND TABLE_NAME = 'users'
      AND COLUMN_NAME = 'name'
);

SET @users_name_sql = IF(
    @users_name_exists = 0,
    "ALTER TABLE users ADD COLUMN name VARCHAR(100) NOT NULL DEFAULT '' AFTER id",
    'SELECT 1'
);

PREPARE users_name_stmt FROM @users_name_sql;

EXECUTE users_name_stmt;

DEALLOCATE PREPARE users_name_stmt;

SET @users_bio_exists = (
    SELECT COUNT(*)
    FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = DATABASE()
      AND TABLE_NAME = 'users'
      AND COLUMN_NAME = 'bio'
);

SET @users_bio_sql = IF(
    @users_bio_exists = 0,
    'ALTER TABLE users ADD COLUMN bio VARCHAR(160) NULL AFTER name',
    'SELECT 1'
);

PREPARE users_bio_stmt FROM @users_bio_sql;

EXECUTE users_bio_stmt;

DEALLOCATE PREPARE users_bio_stmt;
