private function validate($name)
    {
        if (!is_string($name)) {
            throw new InvalidNameException('Migration name must be a string, got ' . gettype($name));
        }

        if (strlen($name) === 0) {
            throw new InvalidNameException('Migration name must not be empty');
        }

        $validCharsRegex = '/^[' . self::NAME_VALID_CHARS_REGEX . ']+$/';
        if (preg_match($validCharsRegex, $name) === 0) {
            $invalidChars = preg_replace('/[' . self::NAME_VALID_CHARS_REGEX . ']/', '', $name);
            throw new InvalidNameException('Migration name contains invalid characters: ' . $invalidChars);
        }

        if (strlen($name) > self::MAX_NAME_LENGTH) {
            throw new InvalidNameException(sprintf(
                'Migration name cannot exceed %d characters, is %d: %s',
                self::MAX_NAME_LENGTH,
                strlen($name),
                $name
            ));
        }
    }