prefix . 'ivyforms_' . static::TABLE; } /** * Create new table in the database */ public static function init(): void { if (file_exists(ABSPATH . 'wp-admin/includes/upgrade.php')) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } // @phpstan-ignore staticMethod.notFound dbDelta(static::buildTable()); global $wpdb; foreach (static::alterTable() as $command) { $wpdb->query($wpdb->prepare($command)); } } /** * Delete table from the database * * @throws InvalidArgumentException */ public static function delete(): void { global $wpdb; $table = self::getTableName(); $sql = "DROP TABLE IF EXISTS $table;"; $wpdb->query($wpdb->prepare($sql)); } /** * @return boolean */ public static function isValidTablePrefix(): bool { global $wpdb; return strlen($wpdb->prefix) <= 16; } /** * @return mixed[] */ public static function alterTable(): array { return []; } }